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

#1 2012-05-29 03:20:24

69liz
Scratcher
Registered: 2007-05-16
Posts: 6

Sprite moving with moving platform

Hi,
I am making a platform game and have added a level with moving platforms. My sprite can land on the platforms but falls off as soon as the platform moves away from him.
I'd like to add another level where he can stay on the platform and move with it.
I am struggling to make this happen - can anyone give me some advice on how to script this please?
Thanks!

Offline

 

#2 2012-05-29 03:52:21

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: Sprite moving with moving platform

You could try something like this - have the player hold down the space bar to "ride" the platform, then if touching platform and space key pressed point in direction of platform and move the same number of steps as the platform.
On the platform script, instead of having it change x/y by (n), make it point in direction of desired motion and move (n) steps. So the platform/player doesn't turn upside down, you can click the double headed arrow on the sprite at the top of the screen next to the sprite picture which locks the direction to right and left only.

That should work  smile


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#3 2012-05-29 04:34:11

69liz
Scratcher
Registered: 2007-05-16
Posts: 6

Re: Sprite moving with moving platform

Hi Prestige,
Thanks for that suggestion. I've got it working!
smile

Offline

 

Board footer