This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2009-04-03 17:18:57

smesj
Scratcher
Registered: 2009-04-03
Posts: 1

side scroller

Hey i apologize if this topic has been discussed already but i couldn't seem to find the topic.

I am working on a side scrolling game and the way i have the screen scrolling right now is when the player reaches a certain x coordinate all of the sprites to represent platforms and obstacles just move in the opposite direction. However when trying to incorporate enemies this poses a problem because technically the player is stuck in one position while the terrain moves making it impossible to outrun enemies if required. They will always catch up. I realize this approach may be very ineffective and i am new to scratch but, i cannot think of any other way to make it work. Does anyone have any other ideas how to make the background and platforms scroll like a common side scrolling shooter?

Offline

 

#2 2009-04-03 17:24:56

demosthenes
Retired Community Moderator
Registered: 2008-02-19
Posts: 1000+

Re: side scroller

Do you mean you want to make enemies for a side-scrolling game? If so this is a good way to do that:
<when green flag clicked>
<forever>
<go to x sad  (( <{ scrollX }> <+> <{ position }> )) )y sad  <{ yPosition }>
<if> <( <abs( <x position>)  <>> 240 )>
<hide>
<else>
<show>

This will make the enemy stay still in a certain area and scroll with the platforms. Hope that helps if that is what you were wondering about.


I've taken a long hiatus, but I still visit sometimes. Give me some time to answer any messages you post on my projects!

Offline

 

#3 2009-04-03 19:26:33

SmartIrishKid
Scratcher
Registered: 2008-07-19
Posts: 1000+

Re: side scroller

Here, try this: http://scratch.mit.edu/projects/SmartIrishKid/261500 It has an enemy that moves based on the scrollX and a separate variable, "walk X".  All it really does is move back and forth, though.


Discuss future Scratch RPGs, online games, and more!

Offline

 

#4 2009-04-05 06:57:44

MyRedNeptune
Community Moderator
Registered: 2007-05-07
Posts: 1000+

Re: side scroller

Here's a good tutorial by Archmage: http://scratch.mit.edu/forums/viewtopic.php?id=2440

Hope this helps.  smile


http://i52.tinypic.com/5es7t0.png I know what you're thinking! "Neptune! Get rid of those filthy advertisements and give us back the Zarathustra siggy, you horrible person!" Well, don't worry about it, the Zara siggy will be back soon, new and improved! ^^ Meanwhile, just do what the sig tells you to. >.>

Offline

 

Board footer