• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

why my image simply not rotate?

G

giannis196

Guest
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.
 
G

giannis196

Guest
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.
 
G

giannis196

Guest
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