why my image simply not rotate?

I made a simple code but it simply won't work and i don't know why...btw i have solid, collision and physics on, and i made a physics collision shape (convex shape)
the code is

GML:
if(keyboard_check("A")){
    image_angle = image_angle + 5
}
 

Tony Brice

Member
Maybe obvious but route out the common questions first.

Is that code in a polled event so it's checked during update time? IE: Step or Draw ?

Have you tried putting a debug message into the keyboard check to make sure there isn't something else stopping that keyboard check ever being processed?

Maybe try switching off physics, solid and anything else just to see if there is a reason these things are preventing it, perhaps.

Failing that, post the whole event code in case question 2 is relevant.
 
Maybe obvious but route out the common questions first.

Is that code in a polled event so it's checked during update time? IE: Step or Draw ?

Have you tried putting a debug message into the keyboard check to make sure there isn't something else stopping that keyboard check ever being processed?

Maybe try switching off physics, solid and anything else just to see if there is a reason these things are preventing it, perhaps.

Failing that, post the whole event code in case question 2 is relevant.
it's pulled from "key press left" event

ok i change it so now it's from step event and the code now is:


GML:
if(keyboard_check(ord("A"))){
    image_angle = image_angle + 5
}

but it's still not doing something
 

Nocturne

Friendly Tyrant
Forum Staff
Admin
1) With physics ON you can't use the regular built in variables (image_angle, for example), you need to use the physics one (in this case phy_rotation). Also, if you don't need physics you shouldn't use physics. Physics is for trying to impliment "real life" physical simulations and is really only worth it for very very specific things, as using it for regular games simply over-complicates everything.

2) You are using the keyboard check function wrong (it should be ord("A"))

3) If the code is already in a Key Event, then you don't need to check the key using the keyboard_check function, and if the key being pressed is the left arrow, then checking for "A" will never work anyway.
 
1) With physics ON you can't use the regular built in variables (image_angle, for example), you need to use the physics one (in this case phy_rotation). Also, if you don't need physics you shouldn't use physics. Physics is for trying to impliment "real life" physical simulations and is really only worth it for very very specific things, as using it for regular games simply over-complicates everything.

2) You are using the keyboard check function wrong (it should be ord("A"))

3) If the code is already in a Key Event, then you don't need to check the key using the keyboard_check function, and if the key being pressed is the left arrow, then checking for "A" will never work anyway.
Thank you!! it worked

you are right i should put phy_rotation
it worked that way, thanks!!
 

TheouAegis

Member
3) If the code is already in a Key Event, then you don't need to check the key using the keyboard_check function, and if the key being pressed is the left arrow, then ch
Key combos. If he holds A while tapping left, assuming he turned physics off, then his code would have been fine. Assuming giannis understood both left and A would be required to be depressed at the same time and A was held before left was pressed.
 
Top