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

#1 2009-10-29 07:39:42

fullwall
Scratcher
Registered: 2009-10-29
Posts: 20

Need help for my platformer

Yeah, so I'm making a platformer, and I need to program in jumps (obviously) However, I need help in making the cat (which is just a placeholder sprite) to stop when he reaches the platform. Right now, it works if he's stationary, however, while moving and jumping continuously, he glitches underneath the platform. Can somebody download my project and tell me how to fix this so he stops when he reaches the platform? It would also help if you could test if it works when he jumps to another platform. Thanks in advance.

Offline

 

#2 2009-10-29 17:17:55

Locomule
Scratcher
Registered: 2009-08-24
Posts: 500+

Re: Need help for my platformer

Congrats, you rediscovered a common problem with object collisions in Scratch. And here is Archmage's tutorial on how to fix it. Have fun!
http://archblogger.wordpress.com/2008/11/06/make-a-game-like-super-mario-world-demo/

ps.. The reason your sprite gradually falls through is because it's velocity is so fast that by the time it finishes Moving and does the next collision check, you've already Moved it part way through the ground. The key to Archmages tutorial (in regards to your Ground problem) is that the "feeler" sprite detects the ground before the sprite actually hits it or falls through. Then resets the downward velocity to 1 so your sprite always lands firmly in the right spot. Now if your initial velocity is too high, you will have to use longer "feelers" which means your Sprite will slow down well before it gets close to the ground. Also, if you have right angle walls, you may want to use different colored feelers so that you can still move at right angles to what ever wall you are up against. If it doesn't make sense now, it will many scripting hours from now  wink


aka Pain from DragonSpires, Delrith Online, BotBattle, Urban Dead etc etc lol

Offline

 

#3 2009-10-30 23:45:38

fullwall
Scratcher
Registered: 2009-10-29
Posts: 20

Re: Need help for my platformer

Could someone please add Archmage's code to my project? I'm hacing a little bit of trouble putting the two together... My character doesn't start at the terrain...

Offline

 

#4 2009-10-31 00:05:18

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Need help for my platformer

Does a set variable block help? Perhaps:

set scrollX to 0

neutral


Hai.

Offline

 

#5 2009-10-31 06:40:06

fullwall
Scratcher
Registered: 2009-10-29
Posts: 20

Re: Need help for my platformer

No, its something to do with setting the position of the block at the start...

Offline

 

Board footer