Skip to content

Commit fe70ce1

Browse files
committedApr 16, 2022
avatar up
1 parent f697aae commit fe70ce1

12 files changed

+153
-30
lines changed
 

‎beau.html

+153-30
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
var background2 = {
6666
file : "background2.gif",
6767
x : 1024,
68-
y : 633,
68+
y : 500,
6969
startx : 0,
7070
starty : 0,
7171
type : "image",
@@ -313,10 +313,14 @@
313313
myGamePiece.left(1);
314314
} else if (event.key == "q" || event.key == "r") {
315315
reset_poor();
316-
} else if (event.key == "f" || event.key == 32 ) {
316+
} else if (event.key == "f" || event.key == "m" ) {
317317
myGamePiece.fire()
318318
} else if (event.key == "z" || event.key == "p") {
319319
myGamePiece.stop()
320+
} else if (event.key == "P" || event.key == "O") {
321+
myGamePiece.pause()
322+
} else if (event.key == "C" || event.key == "H") {
323+
cheat()
320324
}
321325
}),
322326
start : function() {
@@ -511,6 +515,10 @@
511515
myGame2.text=""
512516
this.iwon=1;
513517
gameover=1
518+
myGamePiece.x = Math.floor(background.x/2)
519+
myGamePiece.y = Math.floor(background.y/2)
520+
myGamePiece.width *= 3
521+
myGamePiece.height *= 3
514522
} else {
515523
myGame.text="LEVEL UP"
516524
myGame2.text=""
@@ -527,12 +535,25 @@
527535
updateGameArea()
528536
}
529537
}
530-
this.cheat = function(isPiece) {
538+
this.bigcheat = function(isPiece) {
539+
// kill a ship
540+
// loop over my castles
541+
//for (j = 0; j < this.myCastles.length; j += 1) {
542+
// this.myCastles[j].active = 0;
543+
//}
544+
// loop over enemy castles
545+
for (j = 0; j < yourGamePiece.myCastles.length; j += 1) {
546+
yourGamePiece.myCastles[j].active = 0;
547+
}
548+
// loop over enemy bullets
549+
for (j = 0; j < yourGamePiece.myBullets.length; j += 1) {
550+
yourGamePiece.myBullets[j].active=0;
551+
}
531552
// move to the right
532-
var rockbottom = myGameArea.canvas.width - this.width - buffer;
533-
this.x = rockbottom;
534-
this.newPos(true)
535-
this.update()
553+
//var rockbottom = myGameArea.canvas.width - this.width - buffer;
554+
//this.x = rockbottom;
555+
//this.newPos(true)
556+
yourGamePiece.update()
536557
//this.win()
537558
}
538559
this.die = function() {
@@ -678,6 +699,18 @@
678699
}
679700
}
680701

702+
function cheat() {
703+
// kill a ship
704+
j = Math.floor(Math.random() * yourGamePiece.myCastles.length)
705+
yourGamePiece.myCastles[j].active=0;
706+
// loop over enemy bullets
707+
for (j = 0; j < yourGamePiece.myBullets.length; j += 1) {
708+
yourGamePiece.myBullets[j].active=0;
709+
}
710+
//yourGamePiece.update()
711+
return
712+
}
713+
681714
function loveHearts(myPiece) {
682715
const nBroken = maxlives - myPiece.lives
683716
const nLive = myPiece.lives
@@ -712,6 +745,10 @@
712745
gameover = 1;
713746
myPiece.iwon=0;
714747
yourPiece.iwon=1;
748+
yourPiece.x = Math.floor(background.x/2)
749+
yourPiece.y = Math.floor(background.y/2)
750+
yourPiece.width *= 3
751+
yourPiece.height *= 3
715752
myGame.update();
716753
return true
717754
}
@@ -746,22 +783,16 @@
746783
myPiece.removeCastle(yourPiece.myCastles[j])
747784
if ( myPiece.lives < 1 ) {
748785
// what happens if you lose
749-
if ( level == maxlevels ) {
750-
myGame.text="DOWN A LEVEL"
751-
level -= 1
752-
if ( level < 1 ) level = 1
753-
myGame2.text="PAUSED"
754-
pause_game=1
755-
wait=pause_count
756-
updateGameArea()
757-
reset()
758-
} else {
759-
myGame.text="GAME OVER"
760-
myGame2.text=""
761-
gameover = 1;
762-
myPiece.iwon=0;
763-
yourPiece.iwon=1;
764-
}
786+
myGame.text="GAME OVER"
787+
myGame2.text=""
788+
myPiece.iwon=0;
789+
yourPiece.iwon=1;
790+
gameover = 1;
791+
yourPiece.x = Math.floor(background.x/2)
792+
yourPiece.y = Math.floor(background.y/2)
793+
yourPiece.width *= 3
794+
yourPiece.height *= 3
795+
//myGame.update();
765796
for (i = 0; i < myPiece.myBullets.length; i += 1) {
766797
myPiece.myBullets[i].active = 0
767798
}
@@ -841,11 +872,11 @@
841872
}
842873

843874
for (i = 0; i < myGamePiece.myCastles.length; i += 1) {
844-
myGamePiece.myCastles[i].update();
875+
if ( myGamePiece.myCastles[i].active ) myGamePiece.myCastles[i].update();
845876
}
846877

847878
for (i = 0; i < yourGamePiece.myCastles.length; i += 1) {
848-
if (everyinterval(Math.floor(Math.random()*5000))) {
879+
if (yourGamePiece.myCastles[i].active && everyinterval(Math.floor(Math.random()*5000))) {
849880
myGame.text=""
850881
myGame2.text=""
851882
yourGamePiece.clearArrows()
@@ -924,9 +955,14 @@
924955
reset()
925956
} else {
926957
myGame.text="GAME OVER"
927-
gameover = 1;
928958
myPiece.iwon=0;
959+
gameover = 1;
929960
yourPiece.iwon=1;
961+
yourPiece.x = Math.floor(background.x/2)
962+
yourPiece.y = Math.floor(background.y/2)
963+
yourPiece.width *= 3
964+
yourPiece.height *= 3
965+
//myGame.update();
930966
}
931967
for (i = 0; i < myGamePiece.myBullets.length; i += 1) {
932968
myGamePiece.myBullets[i].active = 0
@@ -1094,17 +1130,104 @@
10941130
<br>
10951131
<button type="button" onmouseover="myGamePiece.fire()" onmousedown="myGamePiece.fire()" onmouseup="myGamePiece.fire()" ontouchstart="myGamePiece.fire()">FIRE</button>
10961132
<br>
1133+
<p>Meet the Tudors: Make it to the right of the screen to win</p>
10971134
<br>
10981135
<br>
10991136
<br>
11001137
<br>
11011138
<br>
1102-
<button type="button onmousedown="bg()" onmouseover="bg()">Background</button>
1103-
<button type="button onmousedown="help()" onmouseover="help()">Help</button>
1104-
<p>Meet the Tudors: Make it to the right of the screen to win</p>
1139+
<br>
1140+
<br>
1141+
<br>
1142+
<br>
1143+
<br><br>
1144+
<br>
1145+
<br>
1146+
<br>
1147+
<br><br>
1148+
<br>
1149+
<br>
1150+
<br>
1151+
<br><br>
1152+
<br>
1153+
<br>
1154+
<br>
1155+
<br><br>
1156+
<br>
1157+
<br>
1158+
<br>
1159+
<br><br>
1160+
<br>
1161+
<br>
1162+
<br>
1163+
<br><br>
1164+
<br>
1165+
<br>
1166+
<br>
1167+
<br><br>
1168+
<br>
1169+
<br>
1170+
<br>
1171+
<br><br>
1172+
<br>
1173+
<br>
1174+
<br>
1175+
<br><br>
1176+
<br>
1177+
<br>
1178+
<br>
1179+
<br><br>
1180+
<br>
1181+
<br>
1182+
<br>
1183+
<br><br>
1184+
<br>
1185+
<br>
1186+
<br>
1187+
<br><br>
1188+
<br>
1189+
<br>
1190+
<br>
1191+
<br><br>
1192+
<br>
1193+
<br>
1194+
<br>
1195+
<br><br>
1196+
<br>
1197+
<br>
1198+
<br>
1199+
<br><br>
1200+
<br>
1201+
<br>
1202+
<br>
1203+
<br><br>
1204+
<br>
1205+
<br>
1206+
<br>
1207+
<br><br>
1208+
<br>
1209+
<br>
1210+
<br>
1211+
<br><br>
1212+
<br>
1213+
<br>
1214+
<br>
1215+
<br><br>
1216+
<br>
1217+
<br>
1218+
<br>
1219+
<br><br>
1220+
<br>
1221+
<br>
1222+
<br>
1223+
<br><br>
1224+
<br>
1225+
<br>
1226+
<br>
1227+
<br>
11051228
<br>
11061229
<button onmousedown="pause('PAUSED')" onmouseover="pause('PAUSED')">pause</button>
1107-
<button onmousedown="myGamePiece.cheat()">cheat</button>
1230+
<button onmousedown="cheat()">cheat</button>
11081231
<button onmousedown="myGamePiece.die()">die</button>
11091232
<br>
11101233
<audio id="myAudio" controls>

‎englishship_2.gif

-2.37 KB
Loading

‎englishship_3.gif

-6.63 KB
Loading

‎englishship_4.gif

-12.5 KB
Loading

‎englishship_5.gif

-15.9 KB
Loading

‎englishship_6.gif

-20.9 KB
Loading

‎spanishship_2.gif

-3.92 KB
Loading

‎spanishship_3.gif

-8.22 KB
Loading

‎spanishship_4.gif

-16.3 KB
Loading

‎spanishship_5.gif

-21.5 KB
Loading

‎spanishship_6.gif

-27.4 KB
Loading

‎xx.gif

30.8 KB
Loading

0 commit comments

Comments
 (0)
Please sign in to comment.