I can not exactly type out a script for you at this moment as i am busy, but I suggest, if what you are after is a bouncing script, check out the script of the project in my signature, it might be helpful.
Offline
For each coin sprite, make a script like this:
Just remember to make xvel and yvel "for this sprite only".whenclicked
hidewhen i receivemonster_dead ▼showgo tomonster ▼setyvel ▼topick random3to10setxvel ▼topick random-10to10repeat untiltouchingplayer ▼?change y byyvelchange x byxveliftouchingground ▼?setyvel ▼toyvel*-1setxvel ▼toxvel*0.8elsechangeyvel ▼by-0.1hide
Offline
BirdByte wrote:
For each coin sprite, make a script like this:
Just remember to make xvel and yvel "for this sprite only".whenclicked
hidewhen i receivemonster_dead ▼showgo tomonster ▼setyvel ▼topick random3to10setxvel ▼topick random-10to10repeat untiltouchingplayer ▼?change y byyvelchange x byxveliftouchingground ▼?setyvel ▼toyvel*-1setxvel ▼toxvel*0.8elsechangeyvel ▼by-0.1hide![]()
after he dies do you know how to make a store so you could buy more things?
Offline
lilyo11 wrote:
BirdByte wrote:
For each coin sprite, make a script like this:
Just remember to make xvel and yvel "for this sprite only".whenclicked
hidewhen i receivemonster_dead ▼showgo tomonster ▼setyvel ▼topick random3to10setxvel ▼topick random-10to10repeat untiltouchingplayer ▼?change y byyvelchange x byxveliftouchingground ▼?setyvel ▼toyvel*-1setxvel ▼toxvel*0.8elsechangeyvel ▼by-0.1hide![]()
after he dies do you know how to make a store so you could buy more things?
That's kinda unrelated to the topic; make a new one about it.
Offline
As an addition to BirdByte's script, you might want to add vertical friction (e.g. set [y-vel v] to ((0.95)*(y-vel))) and/or bouncing off of walls (if it isn't just a flat field).
Offline
MoreGamesNow wrote:
As an addition to BirdByte's script, you might want to add vertical friction (e.g. set [y-vel v] to ((0.95)*(y-vel)) and/or bouncing off of walls (if it isn't just a flat field).
Yeah, do that. XP But remember to make sure that the coin doesn't get stuck in the ground by adding "change y by 1" to the "set yvel to yvel*-1" script.
Offline
Here's the easiest change I could think of. It may even look better since it resolves the bounce in single frame:
whenclicked
hidewhen i receivemonster_dead ▼showgo tomonster ▼setyvel ▼topick random3to10setxvel ▼topick random-10to10repeat untiltouchingplayer ▼?change y byyvelchange x byxveliftouchingground ▼?change y by-1*yvelsetyvel ▼toyvel*-0.8setxvel ▼toxvel*0.8elsechangeyvel ▼by-0.1hide
Offline
Oops, forgot walls. I'll leave the other script up in case you don't need them:
Instead of "set [xvel v] to (pick random (-10) to (10))", you can add the monster's x velocity to a random number (like below) if you want (assuming the monster is moving at a velocity).whenclicked
hidewhen i receivemonster_dead ▼showgo tomonster ▼setyvel ▼topick random3to10setxvel ▼topick random-10to10repeat untiltouchingplayer ▼?changeyvel ▼by-0.1change y byyveliftouchingwall/ground ▼?change y by-1*yvelsetyvel ▼to-0.8*yvelsetxvel ▼to0.8*xvelchange x byxveliftouchingwall/ground ▼?change x by-1*xvelsetxvel ▼to-0.8*xvelhide
setxvel ▼tomonster_x_velocity+pick random-4to4
Offline