Discuss Scratch

sonicfan3231
Scratcher
3 posts

recoil for platformer game

ye me need help
Wolf_Link21
Scratcher
100+ posts

recoil for platformer game

What do you mean by recoil? explain more

This is dave
:D :: hat :: motion
He protects my from evil kumquats.
Please follow me if you find my response helpful and give me any ideas for my game https://scratch.mit.edu/projects/992371983/
LP372
Scratcher
1000+ posts

recoil for platformer game

Wolf_Link21 wrote:

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

Projects I want people to see:
https://scratch.mit.edu/projects/1018171720
Norse7
Scratcher
67 posts

recoil for platformer game

what kind of coil do you want?

“It’s not a bug; it’s an undocumented feature.” ― Anonymous

when green flag clicked
forever
change [ awesomeness] by (1)
end
Norse7
Scratcher
67 posts

recoil for platformer game

Try this

Step 1:
Make some art if don't already have any.

Step 2:
Animate this to look like it is springing down

Step 3:
Make a script for the recoil to follow the scrolling if you have any, and make it so that whenever the player touches the recoil, they spring up.

Step 4:
Inside the script, broadcast a message without wait to the recoil itself. under the “when I receive” block, animate the recoil.

“It’s not a bug; it’s an undocumented feature.” ― Anonymous

when green flag clicked
forever
change [ awesomeness] by (1)
end
waffley-
Scratcher
7 posts

recoil for platformer game

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
sonicfan3231
Scratcher
3 posts

recoil for platformer game

thanks
Norse7
Scratcher
67 posts

recoil for platformer game

oh, I didn't know you meant that.

“It’s not a bug; it’s an undocumented feature.” ― Anonymous

when green flag clicked
forever
change [ awesomeness] by (1)
end
waffley-
Scratcher
7 posts

recoil for platformer game

sonicfan3231 wrote:

thanks

also, I meant for the values to be negative (it'll go towards the recoil point if it wasn't negative)

set [speed x v] to (() - (([sin v] of (dir)) * (recoil power)))
set [speed y v] to (() - (([cos v] of (dir)) * (recoil power)))

Powered by DjangoBB