How can I get a sprite, in a game, to only go to a specific x position and the sprite can't go past it. How can I do this using Scratch?
Offline
Sprite does not go to the right of x:150
<if><( 150 <<> <x position> )>
<set x to( 150
<end>[/blocks]
Sprite does not go to left of x:-150
<if><( <x position> <<> -150 )>
<set x to( -150
<end>[/blocks]
Offline
How can I make a sprite die if the other sprite jumps on it, but if it touches the sprite without jumping, it loses a live? Would I do this:
<when green flag clicked>
<forever if><<<touching[ Sprite1 ] <and> <(<{ Sprite1-X }> <>> <x position>)>>>
<hide>
<end>
Offline
If your sprite changes costume when it jumps, then you could check for "If touching" AND "Costume 2"
Offline
Mayhem wrote:
If your sprite changes costume when it jumps, then you could check for "If touching" AND "Costume 2"
If not, make the feet a different color. And in the enemy:
<if><touching color[ feet color
<hide>
<else>
<if><touching[ player
<change{ lives }by( -1
<end>
<end>
Last edited by bhz (2008-12-04 17:44:45)
Offline
Hm Id prob have a varible to use for this e.g
When jumping costumes ect happen add:
<set{ jumping }to( 1)>
then when he lands
<set{ jumping }to( 0)>
In the other code:
<if><( <{ jumping }> <=> 1 )>
<hide>
<else>
<change{ damage }by( 1)>
Offline
tharvoil wrote:
Hm Id prob have a varible to use for this e.g
When jumping costumes ect happen add:
<set{ jumping }to( 1)>
then when he lands
<set{ jumping }to( 0)>
In the other code:
<if><( <{ jumping }> <=> 1 )>
<hide>
<else>
<change{ damage }by( 1)>
That was my first thought, but if the characters costume changes you can, in fact, use it just like a variable, saving yourself the need to create an extra one.
Offline