Pages: 1
Topic closed
I am trying to improve one of my projects because it's absolute rubbish (see for yourself http://scratch.mit.edu/projects/dominoespizza/1199069) but I don't know how to make things move away from each other when hit. It would be helpful if the object being hit moved away at the same speed as the object hitting it. PLEASE help me!
Offline
Before I post a script, I just wan't to clarify what you need.
You want a script that does this: When to objects hit each other, the go back the other way at the speed of the object it hit.
Offline
thats actually pretty cool
Offline
silvershine wrote:
Before I post a script, I just wan't to clarify what you need.
You want a script that does this: When to objects hit each other, the go back the other way at the speed of the object it hit.
yes i do
Offline
Yes.
I made a bounce block in BYOB. Depending on the direction, use this script with some previousX and previousY variables: [P.S. this is the version for Scratch]
if touching other object
set previousY to y position
set previousX to x position
point in direction [the opposite direction of the one you hit it at]
repeat until touching edge
move 240 steps
end repeat
if on edge, bounce
goto x: previousX y: previousY
end if
Offline
how should i set the previousX and previousY varibles
Offline
would it work if you did object 1 speed, object 2 speed, object 1 bouce and object 2 bounce as
variables for everything and got object 1 to set speed to 0, point away from object 2, make it move at object 1 bounce which will be object 2's speed and eventually slow down and vice versa
Offline
dominoespizza wrote:
would it work if you did object 1 speed, object 2 speed, object 1 bouce and object 2 bounce as
variables for everything and got object 1 to set speed to 0, point away from object 2, make it move at object 1 bounce which will be object 2's speed and eventually slow down and vice versa
thats if it hit object 2
Offline
Topic closed
Pages: 1