Skip to content

Commit 5484b58

Browse files
committedAug 28, 2016
game Dev
1 parent cd1000e commit 5484b58

File tree

3 files changed

+43
-5
lines changed

3 files changed

+43
-5
lines changed
 

‎GameDev2/GuardDuty.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ function soldierLogic() {
88
while(true) {
99
var enemy = soldier.findNearestEnemy();
1010
// Attack the enemy, if the enemy exists.
11-
soldier.attack(enemy);
11+
if(enemy)
12+
soldier.attack(enemy);
1213
// Else, move back to the starting position.
13-
soldier.moveXY(42, 48);
14+
else
15+
soldier.moveXY(42, 48);
1416
}
1517

1618
}

‎GameDev2/Palimpsest.js

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//https://codecombat.com/play/level/palimpsest
2+
3+
// Create your own game!
4+
5+
// Spawn a hero with spawnHeroXY()
6+
7+
var hero = game.spawnHeroXY(12, 10);
8+
// Add at least one goal!
9+
game.addDefeatGoal();
10+
game.addSurviveGoal();
11+
// Spawn objects into the game with spawnXY()
12+
// Spawn 2 "soldier"s.
13+
game.spawnXY("soldier", 35, 20);
14+
game.spawnXY("soldier", 45, 20);
15+
// Spawn 2 "archer"s.
16+
game.spawnXY("archer", 35, 20);
17+
game.spawnXY("archer", 45, 20);
18+
// Spawn 2 "soldier"s.
19+
game.spawnXY("soldier", 35, 20);
20+
game.spawnXY("soldier", 45, 20);
21+
// Spawn 2 "archer"s.
22+
game.spawnXY("archer", 35, 20);
23+
game.spawnXY("archer", 45, 20);
24+
// Spawn 2 "soldier"s.
25+
game.spawnXY("soldier", 35, 20);
26+
game.spawnXY("soldier", 45, 20);
27+
// Spawn 2 "archer"s.
28+
game.spawnXY("archer", 35, 20);
29+
game.spawnXY("archer", 45, 20);
30+
var munchkin1 = game.spawnXY("munchkin", 25, 30);
31+
var munchkin2 = game.spawnXY("munchkin", 25, 35);
32+
var munchkin3 = game.spawnXY("munchkin", 25, 40);

‎WebDev2/Animania.html

+7-3
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@
3030
@keyframes myAnim {
3131
from {
3232
/* Add properties for the start. */
33-
transform: translateX(100%);
33+
width: 100px;
34+
height:100px;
35+
transform: translateX(300%);
3436
background-color:rgb(0, 255, 0);
3537
}
3638
to {
3739
/* Add properties for the end result. */
38-
transform: translateX(-100%);
39-
background-color:rgb(255, 0, 255);
40+
width: 200px;
41+
height:200px;
42+
transform: translateX(3200%);
43+
background-color:rgb(200, 255, 0);
4044
}
4145
}
4246
</style>

0 commit comments

Comments
 (0)