Well I am trying to make a side scrolling, multiple stage, and moving obstical game. I need help on how to do all of this. I would like If people could do it all in sprate posts like 1st one explain how to side scroll 2nd multiple stage ect. Thank You to all that look at this.
Offline
FreddyKruger24 wrote:
Well I am trying to make a side scrolling, multiple stage, and moving obstical game. I need help on how to do all of this. I would like If people could do it all in sprate posts like 1st one explain how to side scroll 2nd multiple stage ect. Thank You to all that look at this.
Although I can't help much due to how late it is, here is a nice wiki article on scrolling.
I hope that this helps! Also, hello FreddyKruger24 and welcome to Scratch! I wish you good fortune on learning how to code!
Offline
I see the others have posted a couple handy links to projects, and wiki articles for creating scrolling backgrounds, so I'll skip that. I'd recommend the wiki article in particular, though, because it explains how it works. Here's a quick rundown of how to implement obstacles, however -
-- Static Objects/Non-moving Obstacles --
As you should know after finishing the article, scrolling backgrounds rely on a base variable, possibly called "XPosition" I.E. background 1's x position is a variable "XPosition" and background 2's is "XPosition + 480" - therefore, say you'd like to place a static object halfway across the screen - simply set it's x position to being "XPosition + 240", and when the backgrounds scrolls, it should stay in its proper place, relative to the background.
As soon as "XPosition" exceeds or drops below a certain value, the object should hide. However, when it's within the correct parameters, it should be made to show. So for the example above, our static object should hide when "XPosition" is 240, because then it'll be at the edge of the screen, and likewise, when it reaches -240.
-- Non-Static Obtacles/Moving enemies ---
For moving objects I'd recommend adding another variable such that the new position code is "XPosition + [ Offset ] + "Movement", and then change the movement variable's value in another script. This will keep the object in the proper place relative to the screen, while still allowing it to move.
Happy scratching,
- iNK
Offline
Basic script, is that you have a var that tells you where you are in the level, so name it placement or something, and when you press the right arrow key, change it by 1. When you press the left arrow key, change it by -1. Also have the 2 ground sprites that go across the screen, have one start in the middle, and the other one way of scrunched to the side where you cant see it. Make this sprite for both of them. Forever if right arrow key pressed, move x position -(however many degrees you want), and when the left arrow key pressed move x position (however many degrees you want). And to have the items show up when you walk through the level is that you tell it
when gf clicked
hide
wait until placement = 300(or something else)
show
forever
if
right arrow key pressed, move x position -(however many degrees you want)
if
left arrow key pressed move x position (however many degrees you want)
HOPE THIS HELPS!
Last edited by ethwok (2013-01-09 06:43:52)
Offline