Tried to make some boots similar to those in Zelda. Basically, you hold down D and run around until you hit a wall or a baddie. Then you get hurt, but you also will hurt baddies.
if (playertouchsme) toweapons booooots;
if (weaponfired) {
if (this.fired == 0) {
this.fired = 1;
this.go = 0;
timeout = .05;
}
}
if (timeout && this.fired == 1) {
if (playersprite>0&&playersprite<8) {
if (playermp <= 100) {
this.speed = 0.5;
if (this.go == 0) {
freezeplayer 1;
sleep 1;
this.go = 1;
}
if (this.go == 1) {
if (keydown(4)) {
playermp -=.05;
if (!onwall(playerx + 0.5,playery + 0.5) && !onwall(playerx + 1,playery + 0.5) && !onwall(playerx + 1.5,playery + 0.5)) {
if (keydown(0)) {
playery -= this.speed;
}
}
else {
hit();
timeout=0;
}
if (!onwall(playerx - 0.5,playery + 1) && !onwall(playerx - 0.5,playery + 2)) {
if (keydown(1)) {
playerx -= this.speed;
}
}
else {
hit();
timeout=0;
}
if (!onwall(playerx + 0.5,playery + 3) && !onwall(playerx + 1,playery + 3) && !onwall(playerx + 1.5,playery + 3)) {
if (keydown(2)) {
playery += this.speed;
}
}
else {
hit();
timeout=0;
}
if (!onwall(playerx + 2.5,playery + 1) && !onwall(playerx + 2.5,playery + 2)) {
if (keydown(3)) {
playerx += this.speed;
}
}
else {
hit();
timeout=0;
}
}
else {
this.fired = 0;
timeout = 0;
}
}
}
else {
this.fired = 0;
timeout = 0;
}
}
timeout = .05;
}
function hit() {
hurt 1;
hitobjects 1,playerx + 0.5,playery + 0.5;
hitobjects 1,playerx + 1,playery + 0.5;
hitobjects 1,playerx + 1.5,playery + 0.5;
hitobjects 1,playerx - 0.5,playery + 1;
hitobjects 1,playerx - 0.5,playery + 2;
hitobjects 1,playerx + 2.5,playery + 1;
hitobjects 1,playerx + 2.5,playery + 2;
hitobjects 1,playerx + 0.5,playery + 3;
hitobjects 1,playerx + 1,playery + 3;
hitobjects 1,playerx + 1.5,playery + 3;
this.fired = 0;
return;
}