D
Darumin
Guest
Hello. I tried looking for the solution to this, but I can't find anything.
I have a script to handle movement and a script nested in it that changes the state and the spriteset of the player object as long as a button is held. It works great, they work in tandem and I'm able to turn the new spriteset on and off and activate the state while I'm moving. Here are my issues, though:
/// MOVEMENT SCRIPT
> Call script that sets the user input.
> Call DEFAULT SPRITE SCRIPT..
> Move player object using physics and the default sprite variables.
/// DEFAULT SPRITE SCRIPT
> If button that changes state is being pressed or held, set state variable contained in player object to new state and change the default sprite variables.
> Else set default sprite variables.
/// PLAYER OBJECT
// Create
> Creates all variables necessary.
// Step
> Execute the current state.
I have a script to handle movement and a script nested in it that changes the state and the spriteset of the player object as long as a button is held. It works great, they work in tandem and I'm able to turn the new spriteset on and off and activate the state while I'm moving. Here are my issues, though:
- If I'm standing still and pressing the button, the sprite_index doesn't change UNTIL I move. I want it to immediately default to the new spriteset at image 0.
- If I release the movement key before I release the key that changes state, it doesn't change back to the default sprite UNTIL I move. I want it to change back as soon as I release the state change key.
/// MOVEMENT SCRIPT
> Call script that sets the user input.
> Call DEFAULT SPRITE SCRIPT..
> Move player object using physics and the default sprite variables.
/// DEFAULT SPRITE SCRIPT
> If button that changes state is being pressed or held, set state variable contained in player object to new state and change the default sprite variables.
> Else set default sprite variables.
/// PLAYER OBJECT
// Create
> Creates all variables necessary.
// Step
> Execute the current state.