Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if state_new
- {
- scr_resetStateVars();
- sprite_index = walkSprite;
- imageSpeed = .1;
- scr_playerUpdateInputs()
- scr_spawnDustParticles(x - (horizontalInputTotal*8), bbox_bottom - 5, 4, irandom_range(4,6));
- state_var[1] = 0; // TIMER FOR DUST
- }
- // COLLECT INPUTS
- scr_playerUpdateInputs()
- // WALKING LOGIC
- var _oldXVelocitySign = sign(velocity[XVELOCITY]);
- scr_xMovement(accel, fric,maxSpeed);
- // DUST/PARTICLE LOGIC
- var _newXVelocitySign = sign(velocity[XVELOCITY])
- if (_newXVelocitySign != 0 and _oldXVelocitySign != 0 and _newXVelocitySign != _oldXVelocitySign)
- {
- scr_spawnDustParticles(x - (_newXVelocitySign*8), bbox_bottom - 5, 4, irandom_range(4,6));
- }
- state_var[1] += 1*global.timeFactor;
- if (state_var[1] >= 30)
- {
- state_var[1] = 0;
- scr_spawnDustParticles(x - (_newXVelocitySign*8), bbox_bottom - 5, 4, irandom_range(4,6));
- }
- // ANIMATION AND FACING
- scr_playerUpdateFacing();
- // STATE SWITCHES
- if (velocity[XVELOCITY] == 0 and horizontalInputTotal == 0)
- {
- scr_stateSwitch("Wait");
- }
- if (downPressed)
- {
- scr_stateSwitch("Crouch");
- }
- if (jumpPressed)
- {
- scr_stateSwitch("Jump");
- }
- if attackPressed
- {
- scr_stateSwitch("Aim");
- }
- if !(onGround)
- {
- scr_stateSwitch("Fall");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement