Skip to content

Commit f112141

Browse files
committed
tweaking/balancing
1 parent b357773 commit f112141

File tree

12 files changed

+111
-53
lines changed

12 files changed

+111
-53
lines changed

src/actions.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,7 @@ export function Resurrect() {
9898

9999
let unit = Skeleton();
100100
game.spawn(unit, corpse.x, 0);
101-
fx.cloud(unit.bounds(), [
102-
[sprites.p_green_1, sprites.p_green_2, sprites.p_green_3],
103-
[sprites.p_green_2, sprites.p_green_3, sprites.p_green_4],
104-
[sprites.p_green_1, sprites.p_green_3, sprites.p_green_5],
105-
]).burst(10).remove();
101+
fx.resurrect(unit).burst(10).remove();
106102

107103
for (let ritual of game.rituals) {
108104
ritual.onResurrection?.(unit);

src/behaviours.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export class LightningStrike extends Behaviour {
222222
//bolt.addBehaviour(new Seeking(bolt));
223223
bolt.vy = -200;
224224
bolt.vx = randomInt(20) - 10;
225-
bolt.y = clamp(50 + randomInt(100), 0, game.stage.ceiling);
225+
bolt.y = clamp(50 + randomInt(100), 0, game.stage.ceiling - 10);
226226
bolt.x = target.x + randomInt(50) - 25;
227227
game.spawn(bolt);
228228
}

src/fx.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as sprites from "./sprites.json";
22
import { ParticleEmitter, Sprite } from "./engine";
33
import { DEG_360, DEG_90, Rectangle } from "./helpers";
4+
import { GameObject } from "./game";
45

56
export function bones() {
67
return new ParticleEmitter({
@@ -76,3 +77,11 @@ export function dust() {
7677
]
7778
});
7879
}
80+
81+
export function resurrect(unit: GameObject) {
82+
return cloud(unit.bounds(), [
83+
[sprites.p_green_1, sprites.p_green_2, sprites.p_green_3],
84+
[sprites.p_green_2, sprites.p_green_3, sprites.p_green_4],
85+
[sprites.p_green_1, sprites.p_green_3, sprites.p_green_5],
86+
]).extend({ frequency: 0 });
87+
}

src/game.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export class Game {
263263
shotsPerRound: 1,
264264
shotOffsetAngle: 0.1,
265265
maxCasts: 3,
266-
casts: 0,
266+
casts: 3,
267267
castRechargeRate: 1000,
268268
castRechargeTimer: 0,
269269
};
@@ -330,15 +330,19 @@ export class Game {
330330
}
331331

332332
update(dt: number) {
333+
this.updateAbility(dt);
333334
this.updateSpell(dt);
334335
this.updateObjects(dt);
335336
this.updatePhysics(dt);
336337
this.updateRituals(dt);
337338
}
338339

339-
private updateSpell(dt: number) {
340+
private updateAbility(dt: number) {
340341
game.ability.timer += dt;
342+
game.player.emitter!.frequency = game.ability.timer >= game.ability.cooldown ? 0.1 : 0;
343+
}
341344

345+
private updateSpell(dt: number) {
342346
if (this.spell.casts < this.spell.maxCasts) {
343347
this.spell.castRechargeTimer += dt;
344348
if (this.spell.castRechargeTimer > this.spell.castRechargeRate) {

src/index.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import * as sprites from "./sprites.json";
22
import { init, updateParticles, updateTweens } from "./engine";
3-
import { Game, INTRO, PLAYING, WIN } from "./game";
3+
import { Game, INTRO, PLAYING, SHOPPING, WIN } from "./game";
44
import { render, screenToSceneCoords } from "./renderer";
55
import { Cast, Resurrect } from "./actions";
66
import { angleBetweenPoints } from "./helpers";
77
import { Player } from "./objects";
88
import { isComplete, isLevelFinished, updateLevel } from "./levels";
9-
import { Studious, Bleed, Bouncing, Unchained, Ceiling, Drunkard, Salvage, Chilly, Hunter, Knockback, Rain, Seer, Doubleshot, Streak, Weightless, Electrodynamics, Impatience } from "./rituals";
9+
import { Studious, Bleed, Bouncing, Tearstone, Ceiling, Drunkard, Salvage, Chilly, Hunter, Knockback, Rain, Seer, Doubleshot, Streak, Weightless, Electrodynamics, Impatience, Vengeful, Avarice, Hardened, Allegiance } from "./rituals";
1010
import { buy, enterShop, selectShopIndex, shop } from "./shop";
1111
import { dust } from "./fx";
1212
import { BPM, play } from "./sounds";
@@ -32,6 +32,7 @@ const INTRO_DIALOGUE = [
3232
];
3333

3434
const OUTRO_DIALOGUE = [
35+
"",
3536
"The king was defeated. Norman could rest...",
3637
"But not for long",
3738
];
@@ -56,7 +57,7 @@ onkeydown = ({ which: key }) => {
5657
if (game.state === PLAYING) {
5758
if (key === SPACE) Resurrect();
5859
if (key === KEY_P) paused = !paused;
59-
} else {
60+
} else if (game.state === SHOPPING) {
6061
if (key === ARROW_UP) selectShopIndex(-1);
6162
if (key === ARROW_DOWN) selectShopIndex(+1);
6263
if (key === ENTER) buy();
@@ -74,10 +75,14 @@ function update(dt: number) {
7475
updateLevel(dt);
7576
}
7677

77-
game.update(dt);
78+
if (game.state !== INTRO) {
79+
game.update(dt);
80+
}
81+
7882
updateTweens(dt);
7983
updateParticles(dt);
8084

85+
8186
if (game.state === PLAYING && isLevelFinished()) {
8287
if (isComplete()) {
8388
onWin();
@@ -126,13 +131,17 @@ shop.rituals = [
126131
Knockback,
127132
Drunkard,
128133
Seer,
129-
Unchained,
134+
Tearstone,
130135
Impatience,
131136
Bleed,
132137
Salvage,
133138
Studious,
134139
Electrodynamics,
135140
Chilly,
141+
Vengeful,
142+
Avarice,
143+
Hardened,
144+
Allegiance,
136145
];
137146

138147
game.dialogue = INTRO_DIALOGUE;

src/objects.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as fx from "./fx";
33
import * as sfx from "./sounds";
44
import { Behaviour, GameObject } from "./game";
55
import { CORPSE, LIVING, SPELL, MOBILE, PLAYER, UNDEAD } from "./tags";
6-
import { DEG_180, DEG_90, randomElement } from "./helpers";
6+
import { DEG_180, DEG_90, randomElement, randomFloat, randomInt } from "./helpers";
77
import { March, Attack, Damaging, Bleeding, Enraged, Summon, Invulnerable, DespawnTimer } from "./behaviours";
88
import { Damage, Die } from "./actions";
99

@@ -23,6 +23,7 @@ export function Player() {
2323
player.collisionMask = LIVING;
2424
player.updateSpeed = 1000;
2525
player.hp = player.maxHp = 5;
26+
player.emitter = fx.resurrect(player);
2627
player.onCollision = unit => {
2728
Damage(player, unit.hp);
2829
Die(unit);
@@ -94,8 +95,8 @@ export function Skeleton() {
9495
export function SkeletonLord() {
9596
let unit = Skeleton();
9697
unit.sprite = sprites.big_skeleton;
97-
unit.hp = unit.maxHp = 5;
98-
unit.updateSpeed = 3000;
98+
unit.hp = unit.maxHp = 3;
99+
unit.updateSpeed = 1500;
99100
return unit;
100101
}
101102

@@ -165,6 +166,13 @@ export function TheKing() {
165166
unit.sprite = sprites.the_king_on_foot;
166167
unit.updateSpeed = unit.updateClock = 1000;
167168
marching.step /= 2;
169+
let t = 0;
170+
unit.addBehaviour().onFrame = dt => {
171+
if ((t += dt) > 100) {
172+
t = 0;
173+
game.spawn(Corpse(), randomInt(game.stage.width), game.stage.ceiling);
174+
}
175+
};
168176
}
169177
};
170178

@@ -351,7 +359,7 @@ export function RoyalGuardOrb() {
351359
export function Wizard() {
352360
let unit = Villager();
353361
unit.sprite = sprites.wizard;
354-
unit.hp = unit.maxHp = 5;
362+
unit.hp = unit.maxHp = 15;
355363
unit.souls = 30;
356364
unit.addBehaviour(new Summon(unit, Portal, 3000));
357365
return unit;

src/renderer.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ export function render(dt: number) {
4646
}
4747

4848
function drawShop() {
49-
write("~~-~--~~~-~~\n", 160, 20);
50-
write(" Rituals\n");
51-
write("~~-~--~~~-~~\n\n");
49+
write("Rituals\n\n", 160, 20);
5250
let selected = shop.items[shop.selectedIndex];
5351
for (let item of shop.items) {
5452
write(
@@ -57,9 +55,7 @@ function drawShop() {
5755
} $${item.cost}\n`,
5856
);
5957
}
60-
write("\n~~-~--~~~-~~\n");
61-
write(selected?.description + "\n");
62-
write("~~-~--~~~-~~\n");
58+
write("\n" + selected?.description + "\n");
6359
}
6460

6561
function drawHud() {

src/rituals.ts

Lines changed: 60 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import * as fx from "./fx";
22
import * as sprites from "./sprites.json";
3-
import { Damage } from "./actions";
43
import { Bleeding, Damaging, DespawnTimer, Frozen, HitStreak, LightningStrike, Seeking } from "./behaviours";
54
import { tween } from "./engine";
65
import { Behaviour, GameObject, RARE, Ritual } from "./game";
7-
import { DEG_180, DEG_360, distance, randomFloat, randomInt } from "./helpers";
6+
import { DEG_180, randomFloat, randomInt } from "./helpers";
87
import { SkeletonLord, Spell } from "./objects";
9-
import { screenshake } from "./renderer";
10-
import { CORPSE, LIVING, UNDEAD } from "./tags";
8+
import { CORPSE, LIVING } from "./tags";
119
import { shop } from "./shop";
1210

1311
// Ritual tags
@@ -53,7 +51,7 @@ export let Hunter: Ritual = {
5351
tags: HOMING,
5452
rarity: RARE,
5553
name: "Hunter",
56-
description: "Spells seek living enemies",
54+
description: "Spells seek targets",
5755
onCast(projectile) {
5856
projectile.addBehaviour(new Seeking(projectile));
5957
},
@@ -94,7 +92,7 @@ class KnockbackSpell extends Behaviour {
9492
export let Knockback: Ritual = {
9593
tags: NONE,
9694
name: "Knockback",
97-
description: "Spells knock enemies backwards",
95+
description: "Spells knock backwards",
9896
onCast(spell) {
9997
spell.addBehaviour(new KnockbackSpell(spell));
10098
},
@@ -148,7 +146,7 @@ export let Rain: Ritual = {
148146
export let Drunkard: Ritual = {
149147
tags: NONE,
150148
name: "Drunkard",
151-
description: "Do 2x damage, but your aim is wobbly",
149+
description: "2x damage, wobbly aim",
152150
onCast(spell) {
153151
spell.vx += randomInt(100) - 50;
154152
spell.vy += randomInt(100) - 50;
@@ -165,25 +163,24 @@ export let Seer: Ritual = {
165163
}
166164
};
167165

168-
export let Unchained: Ritual = {
166+
export let Tearstone: Ritual = {
169167
tags: NONE,
170168
rarity: RARE,
171-
name: "Unchained",
172-
description: "3x damage but max hp is 1",
173-
onActive() {
174-
game.player.hp = game.player.maxHp = 1;
175-
},
169+
name: "Tearstone",
170+
description: "3x damage when on 1 HP",
176171
onCast(spell) {
177-
spell.getBehaviour(Damaging)!.amount *= 3;
172+
if (game.player.hp === 1) {
173+
spell.getBehaviour(Damaging)!.amount *= 3;
174+
}
178175
}
179176
};
180177

181178
export let Impatience: Ritual = {
182-
tags: CASTING_RATE,
179+
tags: NONE,
183180
name: "Impatience",
184-
description: "Casts recharge 2x faster",
181+
description: "Resurrection recharges 2x faster",
185182
onActive() {
186-
game.spell.castRechargeRate /= 2;
183+
game.ability.cooldown /= 2;
187184
}
188185
};
189186

@@ -210,12 +207,17 @@ export let Bleed: Ritual = {
210207
}
211208
};
212209

213-
export let BigFred: Ritual = {
210+
export let Allegiance: Ritual = {
214211
tags: NONE,
215-
name: "Big Fred",
216-
description: "Summon Norman's Neighbour each resurrection",
212+
rarity: RARE,
213+
name: "Allegiance",
214+
description: "Summon your honour guard after resurrections",
217215
onResurrect() {
218-
game.spawn(SkeletonLord(), game.player.x, game.player.y);
216+
for (let i = 0; i < 3; i++) {
217+
let unit = SkeletonLord();
218+
unit.updateSpeed = 200;
219+
game.spawn(unit, i * -15, 0);
220+
}
219221
},
220222
};
221223

@@ -272,11 +274,45 @@ export let Chilly: Ritual = {
272274
if (randomFloat() <= 0.1) {
273275
spell.emitter!.variants = [[sprites.p_ice_1, sprites.p_ice_2, sprites.p_ice_3]];
274276
spell.sprite = sprites.p_skull;
275-
spell.removeBehaviour(spell.getBehaviour(Damaging)!);
277+
spell.getBehaviour(Damaging)!.amount = 0;
276278
// Frozen has to be added before other behaviours, so that it can prevent
277279
// them from updating
278-
spell.addBehaviour().onCollision = target =>
279-
target.addBehaviour(new Frozen(target), 0);
280+
spell.addBehaviour().onCollision = target => {
281+
// King can't be frozen
282+
if (target.mass < 1000) {
283+
target.addBehaviour(new Frozen(target), 0);
284+
}
285+
};
280286
}
281287
},
282288
};
289+
290+
export let Vengeful: Ritual = {
291+
tags: NONE,
292+
name: "Vengeful",
293+
description: "20% chance to resurrect larger skeletons",
294+
onResurrection(object) {
295+
if (randomFloat() < 0.2) {
296+
game.despawn(object);
297+
game.spawn(SkeletonLord(), object.x, object.y);
298+
}
299+
},
300+
};
301+
302+
export let Avarice: Ritual = {
303+
tags: NONE,
304+
name: "Avarice",
305+
description: "+1 soul for each corpse you resurrect",
306+
onResurrection() {
307+
game.addSouls(1);
308+
},
309+
};
310+
311+
export let Hardened: Ritual = {
312+
tags: NONE,
313+
name: "Hardened",
314+
description: "Unead have +1 HP*",
315+
onResurrection(object) {
316+
object.hp = object.maxHp += 1;
317+
}
318+
};

src/shop.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ export function restockShop() {
4949
game.player.hp < game.player.maxHp &&
5050
ShopItem(10 * game.level, "Heal", `Heal 1*`, () => Damage(game.player, -1)),
5151

52-
ShopItem(10 * exp, "Revive", `+1* max hp`, () => {
52+
ShopItem(10 * exp, "Renew", `+1* max hp`, () => {
5353
game.player.maxHp++;
5454
game.player.hp++;
5555
}),
5656

57-
ShopItem(10 * exp, "Charge", "+1\x7F max casts", () => game.spell.maxCasts++),
57+
ShopItem(10 * exp, "Recharge", "+1\x7F max casts", () => game.spell.maxCasts++),
5858

5959
...createRitualItems(),
6060
ShopItem(0, "Continue", "Begin the next level", () => exitShop()),

src/sounds.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,10 @@ function createBassline() {
231231
}
232232

233233
function createLeadLine() {
234-
let a = [A4, E, __, E, A4, E, __, E];
234+
let a = [E4, Q, F4, Q, D4, Q, F4, Q];
235235
let b = [E4, Q, A4, E, E4, E, __, E, A4, E, E4, E, __, E];
236-
let c = [__, H];
237-
return [a, c, a, c, a, c, b].flat();
236+
let c = [__, Q];
237+
return [a, a, a, b].flat();
238238
}
239239

240240
export let synths = {
@@ -290,7 +290,7 @@ export function useLevelSynths() {
290290
if (game.level === 0) synths.ambientOrgan.start();
291291
if (game.level === 1) synths.bass.start();
292292
if (game.level === 2) synths.kick.start();
293-
if (game.level === 4) synths.lead.start();
293+
if (game.level === 7) synths.lead.start();
294294
if (game.level === 9) {
295295
for (let synth of normalLevelSynths) synth.exit()
296296
for (let synth of bossLevelSynths) synth.start()

src/sprites.aseprite

-3 Bytes
Binary file not shown.

src/sprites.png

-3 Bytes
Loading

0 commit comments

Comments
 (0)