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

#1 2013-01-09 17:17:39

Barryboy121
New Scratcher
Registered: 2013-01-07
Posts: 1

Scrolling platformer game HELP!

Hey!

So i'm pretty new to scratch and decided to make a scrolling platformer type game, I have a problem though (Wahey!)

Whenever my character walks to the next part of the screen (Ground 2) the first part (Ground 1) is underneath his toward the end of it... If that makes sense? Any ideas? I've been trying for hours to work this out! haha!

Thanks!

Offline

 

#2 2013-01-09 20:35:10

Kileymeister_test
Scratcher
Registered: 2010-01-31
Posts: 100+

Re: Scrolling platformer game HELP!

I'm guessing, to specify, your problem is that once the first ground sprite is supposed to move offscreen, it remains onscreen and stops moving?  In Scratch, the stage only extends so far to the sides, so you need to tell pieces of the ground to hide or show depending on whether it's onstage or not.

You can use a script like this to check if your ground sprite should be showing or hiding:
http://i46.tinypic.com/rbcfhc.gif


Kileymeister's test account.  I upload engines and demos and stuff for public use.
Currently Working on: Grapple Arms!

Offline

 

#3 2013-01-12 00:41:07

iNKGaming
New Scratcher
Registered: 2012-07-18
Posts: 18

Re: Scrolling platformer game HELP!

This is something frustrating, actually - in Scratch, you can't move the centerpoint of a sprite away from the edge of the screen beyond a certain point, which leaves it sticking out a little bit. The above poster's solution should work, though you may notice the background doesn't flow smoothly off the to left/right before it disappears. though it is at least better than putting up with the odd stacking problem, however, I figure it might be worth an explanation as to why it's not perfect.

Offline

 

#4 2013-01-19 03:23:16

WIlliam7777
Scratcher
Registered: 2012-07-21
Posts: 41

Re: Scrolling platformer game HELP!

Hope this script helps.  smile


when gf clicked

forever  

switch to costume [sensor v]

if <color [#0042FF] is touching [#000008]?> 

if <key [up arrow v] pressed?> 

repeat (15)  

switch to costume [sensor v]

change y by (10)

if <key [right arrow v] pressed?> 

change [scroll v] by (-5)

if <color [#00FF52] is touching [#000008]?> 

change [scroll v] by (5)

end

end

if <key [left arrow v] pressed?> 

change [scroll v] by (5)

if <color [#FF0000] is touching [#000008]?> 

change [scroll v] by (-5)

end

end

switch to costume [ball v]

end

end

end

if <key [right arrow v] pressed?> 

change [scroll v] by (-5)

if <color [#00FF52] is touching [#000008]?> 

change [scroll v] by (5)

end

end

if <key [left arrow v] pressed?> 

change [scroll v] by (5)

if <color [#FF0000] is touching [#000008]?> 

change [scroll v] by (-5)

end

end

if <not <color [#0042FF] is touching [#000008]?>> 

change y by (-3)

end

switch to costume [ball v]

end

Offline

 

Board footer