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

#1 2007-07-31 19:56:39

denefbIah
Scratcher
Registered: 2007-07-31
Posts: 7

keeping character on land

im making a game and i am wondering how do i keep my guy on land and how i keep him from floating when he walks off a cliff

Offline

 

#2 2007-08-01 04:40:24

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: keeping character on land

You need a continuously running script that checks to see if your character is standing on land, and if it isn't, moves him down the screen.

For example, this would allow the character to stand on anythign green (though it has to be the right shade of green.

Forever if <NOT<touching colour green>>
- - Change Y by -1

Or, if your land is a sprite called Land:

Forever if <NOT<touching [Land]>>
- - Change Y by -1

Last edited by Mayhem (2007-08-01 04:41:44)


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#3 2007-08-01 12:36:31

denefbIah
Scratcher
Registered: 2007-07-31
Posts: 7

Re: keeping character on land

ok, i did that, how do i get him to stop shaking?

Last edited by denefbIah (2007-08-01 12:37:00)

Offline

 

#4 2007-08-01 13:56:48

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: keeping character on land

That really depends on how your scripting currently works.

Post your project so far, and we can have a look at what might be wrong.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#5 2007-08-01 22:16:05

denefbIah
Scratcher
Registered: 2007-07-31
Posts: 7

Re: keeping character on land

https://scratch.mit.edu/projects/denefbIah/26088

Offline

 

#6 2007-08-02 04:50:34

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: keeping character on land

Ah.  What's happening is that your script is moving the sprite up if it is touching green, or down if it isn't, so it will always bounce up and down.

The best solution is to use different colours for telling it to go up or down.

If you put a band of a different colour  (eg, dark green) 2 pixels below the top of your "stand on this" colour, then you can have the following checks:

If <not <touching green>>, change Y by -2
If <touching dark green> change Y by 2

Or, you can do something similar except the different colours are in your sprites feet.  Make the bottoms of the feet Dark Blue, and the rest of the feet light bule.

If <not <Dark Blue over green>>, change Y by -2
If <Light Blueover green> change Y by 2


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#7 2007-08-02 04:56:01

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: keeping character on land

You might also want to look at usign the "repeat" function on your fire costume changes.

And also, look at creating a variable "level", that is used to position your sprites etc at the start of each level, you might save yourself a considerable number of colour-checking "If" blocks and broadcasts.

Last edited by Mayhem (2007-08-02 09:01:21)


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#8 2007-08-02 14:10:47

denefbIah
Scratcher
Registered: 2007-07-31
Posts: 7

Re: keeping character on land

ok, thanks a lot!


1 more thing, where do you get the

If <not<touching color>    tag?

Last edited by denefbIah (2007-08-02 15:03:53)

Offline

 

Board footer