Jump to content


Photo

TDS- bouncing objects when colliding help.


  • Please log in to reply
5 replies to this topic

#1 Leonardo_Vieru

Leonardo_Vieru

    GMC Member

  • New Member
  • 78 posts

Posted 20 February 2011 - 11:31 PM

I am working on a Top Down Shooter,and i made some crates and other objects.I want to make it so when i walk into them,they bounce off me and stop moving after it is as a certain distance away from me.I also want them to rotate whilst bouncing off me,but only at a slight angle.How could i do it?
Plus,speaking of crates,i want to make it so they randomly appear at different angles,so i made a couple of sprites within the sprite,but at different angles,so every time they spawn,the computer will choose which sprite it will be out of the image index.But i cant seem to get it right.
I might ask for a lot, but
1: How do you make an object bounce off you and stop moving when it is at a certain distance away from you
2: How to i make it rotate whilst it is bouncing off the player.
3: How do i make it so those objects will all randomly have different sprites out of the image index

Thanks,i would appreciate your help!
  • 0

#2 NeutronicCyanide

NeutronicCyanide

    GMC Member

  • New Member
  • 11 posts

Posted 21 February 2011 - 12:09 AM

3: In create, Image_index=random(10)
2:if bouncing=1 { Image_angle+=random(3)}
1:Err, on collision with obj_player:
direction=-direction
speed=speed+random(3)

Meh :P
  • 0

#3 Leonardo_Vieru

Leonardo_Vieru

    GMC Member

  • New Member
  • 78 posts

Posted 21 February 2011 - 02:28 PM

Thanks.The actual bouncing worked,but the rotation did not work (was said as an unknown command "bouncing") and the random selection out of the image did not work,when i spawned,the objects just "animated" by playing every frame instead of being chosen randomly and staying that way.Plus i tried to make it so the bouncing object would stop moving when it is at a certain distance,but i did not manage that either :unsure:
  • 0

#4 Leonardo_Vieru

Leonardo_Vieru

    GMC Member

  • New Member
  • 78 posts

Posted 21 February 2011 - 02:44 PM

3: In create, Image_index=random(10)
2:if bouncing=1 { Image_angle+=random(3)}
1:Err, on collision with obj_player:
direction=-direction
speed=speed+random(3)

Meh :P


The actual bouncing worked.But the rotation while bouncing was seen as an error since GM8 did not recognise "bouncing".Plus the random selection did not work,because it looped all the frames when spawned,so it was basically animating.I tried to make the bouncing object stop moving(it just moved forever) but i couldnt get it to work :unsure:
But thanks for the bouncing part anyway but i could sure use some help :)
  • 0

#5 NeutronicCyanide

NeutronicCyanide

    GMC Member

  • New Member
  • 11 posts

Posted 21 February 2011 - 10:54 PM

http://www.mediafire...pdurrs4b3wkmsyt

This was made so fast. Try implementing this into your own, otherwise you won't actually learn how. :)
  • 0

#6 Leonardo_Vieru

Leonardo_Vieru

    GMC Member

  • New Member
  • 78 posts

Posted 22 February 2011 - 11:49 AM

http://www.mediafire.com/?pdurrs4b3wkmsyt

This was made so fast. Try implementing this into your own, otherwise you won't actually learn how. :)

Thanks for that.I spent a whole day on the bouncing,and it kind of worked out,i just experimented.But i will use that gmk as a good learning resource.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users