Jump to content


Photo

Collision and pressing keys repeatedly


  • Please log in to reply
No replies to this topic

#1 itsnima24

itsnima24

    GMC Member

  • GMC Member
  • 13 posts
  • Version:GM8

Posted 02 December 2012 - 08:26 AM

Hello!. i am having a problem with collision. When my character (mouse) collides with the cheese, the player has to press A and D repeatedly to make it disappear. (the sprite changes gradually until it disappears) However, when the mouse collides with the cheese and you press A, the cheese doesn't change, but if i move the mouse with the Up arrow key while colliding with the cheese and then press A, that is when the cheese changes. D: I'm confused.

This is the code I used in the Step event for the mouse
if collision_rectangle(x,y,166,192,obj_cheese_full,1,0)&& keyboard_check(ord("A"))
 {
    instance_change(obj_cheese_half,true)}

My code for Collision with obj_cheese_full
if keyboard_check(ord("A")) { 
 instance_change(obj_cheese_half,true)
    
    }

And here is the code for the Keyboard A event
if collision_rectangle(x,y,166,192,obj_cheese_full,1,0)&& alarm[0]=-1 {
    instance_change(obj_cheese_half,true)
    }


Am I on the right track? Do you have any codes that would help?
Please help. D:
Thank you!

Edited by itsnima24, 03 December 2012 - 04:24 AM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users