• 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!

GameMaker Array code is not working

H

HoboJoeFish

Guest
I'm trying to make this code move my player along a path that I make when I click my mouse down. So if I click the mouse and draw a circle, the player will move in that circle. But I can't even get it to run and I don't know if this will work. Any advice would be greatly appreciated.
 

Attachments

Umaro

Member
Why are you checking the length of an array you don't use later? Also you're using "ocounter" instead of "icounter", and I think GMS2 uses "array_length_1D" instead.
 
H

HoboJoeFish

Guest
Why are you checking the length of an array you don't use later? Also you're using "ocounter" instead of "icounter", and I think GMS2 uses "array_length_1D" instead.
ah yes. Well you see I am very bad at coding. im trying to get this working with little coding skills. But I didnt use array_length_1d because it says its obsolete
 

Nidoking

Member
It looks like all of the code that can affect movement only runs on the step when the mouse button is released.
 

samspade

Member
Agreed with @Nidoking. It seems like you should just remove the second mouse button check. If the mouse button is pressed, you set the target point, at all times (including after the mouse button is pressed) you move towards that point.

mouse_check_button_released means the frame, and it is only one frame, that that you stop holding the mouse key (not the mouse button isn't being held). If you need to code that then would check for !mouse_check_button(mb_left).

(Also, if you post your code as code, then we have an easier time answering because in that case I could have copied it and just made changes to show what I meant)
 
Top