We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6a12b07 commit d61309fCopy full SHA for d61309f
1 file changed
src/demo/ents/superball.ts
@@ -10,9 +10,16 @@ export class SuperballHook implements V.Hook {
10
ent.sprite.y += ent.superball.vy * v.tick.s
11
12
const left = v.cam.x
13
- const right = v.cam.x + v.cam.w - ent.sprite.w
+ const right = v.cam.x + v.cam.w - ent.sprite.hitbox!.w
14
const top = v.cam.y
15
- const bottom = v.cam.y + v.cam.h - ent.sprite.h
+ const bottom = v.cam.y + v.cam.h - ent.sprite.hitbox!.h
16
+
17
+ if (v.loader.cursor?.sprite.hitsZ(ent.sprite, v.cam)) {
18
+ ent.superball.vx = -ent.superball.vx
19
+ ent.superball.vy = -ent.superball.vy
20
+ ent.sprite.x += ent.superball.vx * 2 * v.tick.s
21
+ ent.sprite.y += ent.superball.vy * 2 * v.tick.s
22
+ }
23
24
if (ent.sprite.x < left) {
25
ent.sprite.x = left
0 commit comments