Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Init function, initializing the state information
- init = (state) => {
- state.title = "NierPixel.com"
- state.gravity = 0.2
- state.player = {
- x: 0,
- y: 0,
- flip:false,
- dashing:false,
- initialSpeed: 1,
- speed: 1,
- dx:0,
- dy:0,
- spr:0
- }
- }
- //Dash speed increase
- const standardDash = (player) => {
- player.dashing = true
- player.speed += 5
- }
- //Standard Dash
- if(input.selectPressed && player.dashing === false) {
- standardDash(player);
- } else {
- //Reduce player speed to initial after dashing is complete
- if(player.speed > player.initialSpeed) {
- player.speed = clamp(player.speed - player.speed * (elapsed / 150), 1, 7)
- } else {
- player.dashing = false
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement