Skip to content

Commit 398134a

Browse files
committed
SHIP IT
1 parent d06e2c1 commit 398134a

5 files changed

Lines changed: 40 additions & 17 deletions

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## Play the Game
2+
http://caffeineaddicted.de/ld/ld39/
3+
14
## Development
25

36
### Setup
@@ -13,3 +16,6 @@ typings i
1316
### Developing
1417

1518
`gulp serve|dist|clean`
19+
20+
21+

app/assets/trigger.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@
1212
"enter": "story:tutorial1-enter",
1313
"exit": "story:hide-dialog"
1414
},
15+
{
16+
"x": 12,
17+
"y": 3,
18+
"enter": "story:tutorial2-enter",
19+
"exit": "story:hide-dialog"
20+
},
1521
{
1622
"x":40,
1723
"y":20,

src/classes/ai.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ export class AI {
193193
default:
194194
throw new Error("Unknown AIType. Fix your shit!")
195195
}
196-
this.reactionDelay *= 2
196+
this.reactionDelay *= 1.8
197+
this.maxSpeed *= 2
197198
this.newSound()
198199
this.maxSpeed *= this.tileSize
199200
this.sprite = this.gameState.layerManager.layer("npc").add(this.gameState.game.add.sprite(0, 0, spriteKey))

src/states/game.ts

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ enum LEVEL {
1414

1515
export class GameState extends State {
1616

17-
energyLossPerSecond: number = 0.1
17+
energyLossPerSecond: number = 1
1818
layers: { [layer: string]: Phaser.TilemapLayer } = {}
1919
zoom: number = 1
2020
map: Phaser.Tilemap
@@ -97,7 +97,7 @@ export class GameState extends State {
9797
this.simulator = new Simulator(this)
9898
// this.simulator.spawn(AIType.VEHICLE, AIState.DRIVING)
9999
this.simulator.spawn(AIType.GUARD, AIState.IDLE)
100-
//let t = this.simulator.spawn(AIType.GUARD, AIState.IDLE, new Phaser.Point(0, 0))
100+
this.simulator.spawn(AIType.SLEEPING, AIState.IDLE, new Phaser.Point(12, 7))
101101

102102
this.simulator.spawn(AIType.VEHICLE, AIState.PARKING)
103103
//this.simulator.spawn(AIType.VEHICLE, AIState.PARKING)
@@ -118,22 +118,26 @@ export class GameState extends State {
118118
this.game.forceSingleUpdate = true
119119
}
120120
_update = () => {
121-
//console.log("ENERGY", this.energyReserve)
121+
if (this.energyReserve <= 0) {
122+
this.gameOver()
123+
window.location.href = "./gameover.html" //fucking dirty hotfix, fix statechange asap
124+
}
125+
122126
this.currentTile = this.getCurrentTile()
123127
// this.ref("dialog", "dialog").above(this.ref("player", "player").position.x, this.ref("player", "player").position.y)
124128
this.game.physics.arcade.collide(this.ref("player", "player"), this.layers["ground"])
125-
if (!this.sprinting) {
129+
//if (!this.sprinting) {
126130
this.game.physics.arcade.collide(this.ref("player", "player"), this.layers["collision"])
127-
}
131+
//}
128132
this.energyReserve -= this.energyLossPerSecond * this.game.time.elapsedMS / 1000.
129133

130134
// movement
131135
let damping = 100
132-
let max = 200
133-
let rate = 80
136+
let max = 80
137+
let rate = 30
134138
if (this.sprinting) {
135-
max = 1000
136-
rate = 900
139+
max = 130
140+
rate = 40
137141
}
138142

139143
//this.ref("player", "player").rotation = this.ref("player", "player").body.angle
@@ -239,24 +243,25 @@ export class GameState extends State {
239243
window.document.getElementById("led4")!.style.animationDuration = "0s"
240244
this.gameOver()
241245

242-
} else if (this.energyReserve < 10) {
246+
} else if (this.energyReserve < 20) {
243247
batled.style.animationName = "blink-red"
244248
batled.style.animationDuration = "1s"
245-
} else if (this.energyReserve < 20) {
249+
} else if (this.energyReserve < 30) {
246250
batled.style.fill = "orange"
247251
batled.style.animationDuration = "0s"
248252

249253
} else {
250254
batled.style.fill = "lime"
251255
batled.style.animationDuration = "0s"
252256
}
257+
253258
}
254259
_render = () => {
255260
// this.game.debug.body(this.ref("player", "player"))
256261
// this.game.debug.cameraInfo(this.game.camera, 32, 32)
257262
}
258263

259-
_energyReserve: number = 100
264+
_energyReserve: number = 30
260265

261266
get energyReserve() {
262267
return this._energyReserve
@@ -458,9 +463,10 @@ export class GameState extends State {
458463
}
459464

460465
gameOver() {
461-
this.shutdown()
462-
//console.log("GAME OVER")
463466
this.changeState("end")
467+
this.shutdown()
468+
log("GAME OVER")
469+
464470
}
465471

466472
clubPlayer(amount: number) {
@@ -561,7 +567,11 @@ export class GameState extends State {
561567
this.showDialogAbove("dialog", t.x, t.y, "Welcome to the game!")
562568
break
563569
case "tutorial1-enter":
564-
this.showDialogAbove("dialog", t.x, t.y, "Papers on the floor can be very usefull ;)")
570+
this.showDialogAbove("dialog", t.x, t.y, "Papers on the floor can be very useful ;)")
571+
this.unlockLevel(LEVEL.PARKINGLOT)
572+
break
573+
case "tutorial2-enter":
574+
this.showDialogAbove("dialog", t.x, t.y, "You might have noticed that your Battery is running low.\n But that guy over there looks like he has a full charge in his smartphone...\n Try pressing <space> next to him...")
565575
this.unlockLevel(LEVEL.PARKINGLOT)
566576
break
567577
case "message-under-construction-enter":

src/states/menu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {log, State, range} from "../sgl/sgl"
22

33
export class MenuState extends State {
44

5-
ready: boolean = true// TODO: false
5+
ready: boolean = false
66
booted: boolean = false
77
text: Phaser.Text
88
keys: Phaser.Sound[] = []

0 commit comments

Comments
 (0)