I guess there are two ways of doing this...
1. if <touching [wall]>
move (-[how many ever steps it moves already]) steps
Example, if it moves 3 steps:
if <touching [wall]>
move (-3) steps
2. Create Sensors
Sensor script:
if <touching wall>
set hitTest to 1
else
set hitTest to 0
hitTest is a variable for THAT SPRITE ONLY.
Tank's script:
if <<Key [right arrow] is pressed> and <((hitTest of Sensor) = (1))>>
move (how many you want) steps.
I know, it's kind of hard to understand, if you still don't understand, tell me and I will create a project demonstration
.
Last edited by TimeFreeze (2009-08-30 12:46:18)
Offline
Here's another approach you might try...
http://scratch.mit.edu/projects/Paddle2SeeFixIt/188807
Offline
Thank you but it is a tank game where it is user verus computer and there are walls you can hide behind (i don't have a sesor board) and i know how to stop the bullet but i don't want to tanks to go through.
Offline
snipper9 wrote:
Thank you but it is a tank game where it is user verus computer and there are walls you can hide behind (i don't have a sesor board) and i know how to stop the bullet but i don't want to tanks to go through.
Sure, I understand. That demo I pointed you towards would probably do the trick. Replace the cat costume with a tank and you have a tank that won't go through walls.
Offline
I KNOW HOW TO DO IT
Put:
When Flag click
Forever if, touching ...sprite (e.g)...
point towards, direction
move -2(e.g) steps
Then it will move back the way it came however many steps you want!
DIAGRAMS BELOW:
[blocks]<when green flag clicked><when green flag clicked>[/blocks]
[blocks]<forever if><touching[ [/blocks]
[blocks] <point towards( <direction>[/blocks]
[blocks] <move( )steps>[/blocks]
Offline
Shouldn't this go in All About Scratch?
Offline