waffley- waffley- loading

LP372 wrote:

Wolf_Link21 wrote:

What do you mean by recoil? explain more
Recoil is when it moves slightly up and down when repeating, practically.

No, that's not what it means. It means a backwards motion. achieving recoil is really simple. You'd have to find the x and y movement in any angle (I.e. 90 degrees = 1x 0y, 45 degrees = 1x 1y, etc), then you'd reverse that movement. It wouldn't make sense to tune x y movement based of the “move () steps” block (if you make it always turn you) as you move the amount of pixels in a direction (it'll go away from cursor).

here's how it should be coded
//NOTE: scratch made life a ton easier by using degrees, not radians
///here's variable(s) needed
(Dir) // this is to keep from the sprite from recoil from you
(recoil power) // recoil power, hence the name

point towards [recoil cause device v] // optional

when I receive [recoil event v]
set [dir v] to (direction) // this is where the recoil direction (or the direction to the item causing recoil activation spot)
set [speed y v] to (([cos v] of (dir)) * (recoil power)) // don't use sine (sin)
set [speed x v] to (([sin v] of (dir)) * (recoil power)) // don't use cosine (cos)

//make sure you have platforming script to make the script work