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
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
(( <{ scrollX }> <+> <{ position }> )) )y
<{ 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.
Offline
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.
Offline
Here's a good tutorial by Archmage: http://scratch.mit.edu/forums/viewtopic.php?id=2440
Hope this helps.
Offline