I'm having another difficulty.
I have two sprites, one that moves (Sprite1) and one that's immobile (Sprite2).
I want Sprite1 to do something like this: If touching Sprite2, stop moving.
However, when a different arrow key is pressed, Sprite1 can move. I don't want it to be able to stop moving forever. Any suggestions?
Offline
Make a variable called "move". For the arrow key scripts, put the script inside of an if block, like this:
When key pressed
If <(move) = (1)
|Move (_) steps
End if
Then make a script like this:
When green flag clicked
Forever
|If <touching Sprite2>
||Set (move) to 0
|End if
Offline
I did what you said, but when it does touch the sprite, it sets move to 0 and then it's incapable of moving at all, since move does not equal 1.
Offline
You really need sensing... you could look at my Almost Perfect Platformer project for help...
Offline
shadow_7283 wrote:
You really need sensing... you could look at my Almost Perfect Platformer project for help...
Actually, I tried this. I did use sensing with it, but ultimately, I need it so that it can still move after it touches the sprite, except not in the same direction as when it bumped into the sprite.
Or something.
Offline
Can you upload your project so I can see exactly how to help?
Offline
New blocks is a good idea. But they can't program everything. Love the idea!
Offline
It's sort of like the Pokemon games. If the player touches a house, they are unable to continue any further in that direction. However, when they press another arrow, they can continue along their way.
Offline
See if you can find my solution to this problem with walls in this app...
http://scratch.mit.edu/projects/Locomule/708768
Not only was the player initially getting stuck in walls, it also had another problem with corners where two walls met. Fixed all that.
Offline