Skip to content

Commit 9c55562

Browse files
authored
Merge pull request #131 from Parallaxes/main
no holding allowed for attack
2 parents 7851171 + 8697c0f commit 9c55562

File tree

5 files changed

+27
-13
lines changed

5 files changed

+27
-13
lines changed

assets/js/platformer/GameSetterSkibidi.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ const assets = {
180180
},
181181
escaper: {
182182
src: "/images/platformer/sprites/skibidiMan.png",
183-
width: 54,
184-
height: 60,
183+
width: 53,
184+
height: 61,
185185
scaleSize: 110,
186186
speedRatio: 0.9,
187187
animationSpeed: 5.5, // How fast it goes through displaying each frame in specified row below:
188-
idle: {row: 0, frames: 4 }, // idle animation
188+
idle: {row: 3, frames: 4 }, // idle animation
189189
walk: { row: 1, frames: 6 }, // walking animation
190190
run: { row: 2, frames: 6}, // running animation
191191
jump: {row: 4, frames: 6 }, // jumping animation
@@ -509,7 +509,9 @@ const assets = {
509509
{ name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: assets.platforms.sand, xPercentage: 0.6, yPercentage: 0.71 } ,
510510
{ name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: assets.platforms.sand, xPercentage: 0.14, yPercentage: 0.84 },
511511
{ name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: assets.platforms.sand, xPercentage: 0.7, yPercentage: 0.84 },
512-
{ name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: assets.platforms.sand, xPercentage: 0.3, yPercentage: 0.4 },
512+
{ name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: assets.platforms.sand, xPercentage: 0.4, yPercentage: 0.4 },
513+
{ name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: assets.platforms.sand, xPercentage: 0.36, yPercentage: 0.4 },
514+
{ name: 'blocks', id: 'jumpPlatform', class: BlockPlatform, data: assets.platforms.sand, xPercentage: 0.38, yPercentage: 0.4 },
513515
///{ name: 'coin', id: 'coin', class: Coin, data: assets.obstacles.vbucks, xPercentage: 0.475, yPercentage: 0.5 },
514516
// { name: 'itemBlock2', id: 'jumpPlatform', class: JumpPlatform2, data: assets.platforms.itemBlock2, xPercentage: 0.56, yPercentage: 0.8 }, //item block is a platform
515517
//{ name: 'itemBlock2', id: 'jumpPlatform', class: BlockPlatform, data: assets.platforms.itemBlock2, xPercentage: 0.56, yPercentage: 0.8 }, //item block is a platform

assets/js/platformer/PlayerSkibidi.js

+20-8
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,28 @@ export class PlayerSkibidi extends PlayerBaseOneD {
127127
GameEnv.playerAttack = false;
128128
break;
129129
case 'b':
130-
this.state.animation = 'attack'; // Always trigger attack when b is pressed
131-
GameEnv.playerAttack = true;
132-
break;
133-
default:
134-
this.state.animation = 'idle';
135-
GameEnv.playerAttack = false;
136-
break;
137-
}
130+
// Trigger attack once per key press, no holding allowed
131+
if (!this.state.isAttacking) { // Check if player isn't already attacking
132+
this.state.animation = 'attack'; // Set the animation to attack
133+
GameEnv.playerAttack = true; // Set player attack state to true
134+
this.state.isAttacking = true; // Set the player as attacking
135+
136+
// Reset the attack state after the animation ends (set it to 500ms for now)
137+
setTimeout(() => {
138+
this.state.isAttacking = false;
139+
GameEnv.playerAttack = false;
140+
}, 500); // 500ms delay for one attack per key tap (adjust timing based on animation)
141+
}
142+
break;
143+
default:
144+
this.state.animation = 'idle';
145+
GameEnv.playerAttack = false;
146+
break;
147+
}
138148
}
139149

150+
151+
140152
/**
141153
* @override
142154
* gameloop: Handles additional Player reaction / state updates to the collision for game level

assets/js/platformer/SkibidiTitan.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export class skibidiTitan extends Character {
4646

4747
hpLoss() {
4848
if (GameEnv.playerAttack && !this.state.isDead) {
49-
this.currentHp -= 1;
49+
this.currentHp -= 2.5;
5050
}
5151
}
5252

images/platformer/sprites/beta.png

83.3 KB
Loading

images/platformer/sprites/luffy.png

320 KB
Loading

0 commit comments

Comments
 (0)