Skip to content

Commit 103d51b

Browse files
committed
Changed some CS in scripts
1 parent 75db913 commit 103d51b

4 files changed

Lines changed: 15 additions & 35 deletions

File tree

src/entities/puppy.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const FLEE_DISTANCE = 300;
1+
const FLEE_DISTANCE = 300
22

33
export class Puppy {
44
constructor(k, WALL_THICKNESS, player, playerSpeed) {
@@ -37,23 +37,23 @@ export class Puppy {
3737

3838
respawn(position) {
3939
if (position) {
40-
this.gameObject.pos = position;
40+
this.gameObject.pos = position
4141
} else {
42-
// Fallback to random position if no specific one is given
43-
this.gameObject.pos = this.k.rand(
44-
this.k.vec2(this.WALL_THICKNESS, this.WALL_THICKNESS),
45-
this.k.vec2(
46-
this.k.width() - this.WALL_THICKNESS - this.gameObject.width,
47-
this.k.height() - this.WALL_THICKNESS - this.gameObject.height
48-
)
42+
// Fallback to random position if no specific one is given
43+
this.gameObject.pos = this.k.rand(
44+
this.k.vec2(this.WALL_THICKNESS, this.WALL_THICKNESS),
45+
this.k.vec2(
46+
this.k.width() - this.WALL_THICKNESS - this.gameObject.width,
47+
this.k.height() - this.WALL_THICKNESS - this.gameObject.height
4948
)
49+
)
5050
}
5151
}
5252

5353
update() {
5454
const dirToPlayer = this.player.pos.sub(this.gameObject.pos)
5555
const dist = dirToPlayer.len()
56-
let currentSpeed = this.wanderSpeed;
56+
let currentSpeed = this.wanderSpeed
5757

5858
if (dist < FLEE_DISTANCE) {
5959
this.direction = dirToPlayer.scale(-1).unit()

src/scenes/lose.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,9 @@ export function createLoseScene(k) {
1313
const yOffset = k.height() / 2 - 3 * 30
1414

1515
new Text(k, 'Konec hry', { line: 0, yOffset, anchor: 'center' })
16-
1716
new Text(k, 'Chycen: ' + GameStore.score, { line: 2, yOffset, anchor: 'center' })
18-
1917
new Text(k, 'Rekord: ' + GameStore.highScore, { line: 3, yOffset, anchor: 'center' })
2018

21-
//new Text(k, 'Pokračuj mezerníkem / klikem', { line: 5, yOffset, anchor: 'center' })
22-
2319
k.onKeyDown('space', () => {
2420
k.go('start')
2521
})

src/scenes/start.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ export function createStartScene(k) {
2020
k.anchor("center"),
2121
k.outline(4),
2222
k.color(255, 255, 255),
23-
]);
23+
])
2424

2525
// add a child object that displays the text
2626
btn.add([
2727
k.text('Start'),
2828
k.anchor('center'),
2929
k.color(0, 0, 0),
30-
]);
30+
])
3131

3232
new Text(k, 'Rekord: ' + GameStore.highScore, {
3333
pos: k.vec2(k.width() / 2, k.height() / 2 + 80),

vite.config.js

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,8 @@
11
import { defineConfig } from 'vite'
22

3-
const kaplayCongrats = () => {
4-
return {
5-
name: 'vite-plugin-kaplay-hello',
6-
buildEnd() {
7-
const line = '---------------------------------------------------------';
8-
const msg = `🦖 Awesome pal! Send your game to us:\n\n💎 Discord: https://discord.com/invite/aQ6RuQm3TF \n💖 Donate to KAPLAY: https://opencollective.com/kaplay\n\ (you can disable this msg on vite.config)`;
9-
10-
process.stdout.write(`\n${line}\n${msg}\n${line}\n`);
11-
},
12-
};
13-
};
14-
153
export default defineConfig({
164
// index.html out file will start with a relative path for script
17-
base: "./",
5+
base: './',
186
server: {
197
port: 3001,
208
},
@@ -24,13 +12,9 @@ export default defineConfig({
2412
rollupOptions: {
2513
output: {
2614
manualChunks: {
27-
kaplay: ["kaplay"],
15+
kaplay: ['kaplay'],
2816
},
2917
},
3018
},
3119
},
32-
plugins: [
33-
// Disable messages removing this line
34-
kaplayCongrats(),
35-
],
36-
});
20+
})

0 commit comments

Comments
 (0)