Chaser
Member
Hi having some issues, gamemaker appears to be creating my character every time it changes to a state. This has not done this all week, working fine and as intended until today, i opened the project, ran it before doing anything else and i've been trying to figure out why its started doing this.
Im using a state machine:
heres the code bits:
Room Creation Code: (Shortened)
enum states
{
P1idle,
P1Walk
}
Player Object ( Step event) (shortened)
switch(states)
{
case states.P1idle: scr_player_1_idle(); break;
case states.P1Walkright: scr_player_1_Walkright(); break;
}
Scripts: scr_player_1_idle()
keyboard_check(vk_right)
{
states = states.P1Walkright;
}
Scripts: scr_player_1_Walk()
keyboard_check(vk_nokey)
{
states = states.P1idle;
}
Player Object ( create event)
states = states.P1idle;
note: I have had other states in this game but i eliminated all off them to try and identify the problem, which i didn't, so im back to the original first two states and the problem persists.
As i said this was working fine up until today. i've cleaned the target, restarted my computer and i'm sorry i need to reach out now as to why this is happening, i cannot find anything wrong with my code. its just bizarre. Why is gamemaker constantly creating my player object every frame? and in every state? theres is nothing in my code that tells gamemaker to 'Create' anything, only to change states.
Any help would be so appreciated
Im using a state machine:
heres the code bits:
Room Creation Code: (Shortened)
enum states
{
P1idle,
P1Walk
}
Player Object ( Step event) (shortened)
switch(states)
{
case states.P1idle: scr_player_1_idle(); break;
case states.P1Walkright: scr_player_1_Walkright(); break;
}
Scripts: scr_player_1_idle()
keyboard_check(vk_right)
{
states = states.P1Walkright;
}
Scripts: scr_player_1_Walk()
keyboard_check(vk_nokey)
{
states = states.P1idle;
}
Player Object ( create event)
states = states.P1idle;
note: I have had other states in this game but i eliminated all off them to try and identify the problem, which i didn't, so im back to the original first two states and the problem persists.
As i said this was working fine up until today. i've cleaned the target, restarted my computer and i'm sorry i need to reach out now as to why this is happening, i cannot find anything wrong with my code. its just bizarre. Why is gamemaker constantly creating my player object every frame? and in every state? theres is nothing in my code that tells gamemaker to 'Create' anything, only to change states.
Any help would be so appreciated
Attachments
-
40.1 KB Views: 7