Questions tagged [kaboom]

For questions about games created with the Kaboom JavaScript library.

Kaboom is a JavaScript library for creating simple browser based games.

37 questions
4
votes
1 answer

Kaboom.js: how to set the background to an image

I'm making a kaboom.js game and I want to set the background of a scene to an image. I can only find solutions on changing the background to a colour. I hope someone can help!
2
votes
1 answer

How to switch the player's sprite image in JavaScript/Kaboom.js

So, I want to make a game where you need to take coins and be bigger, but when you take 4 coins I need to reset the player scale (Reset Player Scale is not a problem) and I need to switch the player image, the sprite for another, like a pass Level…
2
votes
0 answers

Animation isn't playing after I specify which frames to play

I've started trying to make a game with kaboom.js and have come across a problem where the animation for an arrow which flashes isn't playing, it just freeze frames at the first frame. Does anybody know what I'm doing wrong? The Code const k =…
Ametrine
  • 73
  • 6
1
vote
1 answer

Kaboom.js; How to check if there is a collision when a key is pressed

The answer seemed simple at first, but it didn't work. Here's what I did: import kaboom from "kaboom"; kaboom(); loadSprite("bean", "sprites/bean.png"); const player = add([ sprite("bean"), pos(80, height() / 2), area(), …
ColoredHue
  • 59
  • 7
1
vote
0 answers

Detect Collisions with Drag and Drop - Kaboom

I want to create an "organizer" game where the player needs to drag-and-drop sprites into a rectangle or a circular sprite. I tried to use container.onCollision('correspondingsprite', (css)=>{destroy(css)}, however, this didn't work. When I removed…
1
vote
0 answers

Is there a way to check if an object is being hovered on with an if statement with kaboomJS?

I've been taking a look at this replit, and it seems like it's the alpha version of kaboomJS. In the area() section of the page it says that this is a way to return a true value when an object is being hovered on. Though it seems like it's not…
Ametrine
  • 73
  • 6
1
vote
1 answer

How to fix jump is not a function error (Kaboom.js)?

I was trying to create a small flappy bird clone but I've run in into this error which I can't fix. Also I'm using VS Code, if that matters. Error: TypeError: player.jump is not a function at Object.cb…
SGTMM
  • 31
  • 5
1
vote
1 answer

How can you add text to a string and then save and print it on the screen in Kaboom.js?

Kia ora everyone! I'm trying to make my own input system in Kaboom.js by adding functions like the below and adding each key to a string called i (short for input). keyPress("j", () => { i.concat("j"); }); Then, I try and console.log i. (i do it…
CassieCodes
  • 57
  • 1
  • 5
1
vote
0 answers

How do I tell if my player is to the left or the right of my enemy in javascript?

I need to check if my player is on the left side or the right side of my enemy sprite so that I can move the enemy toward the player in that direction. How do you check what side a sprite is on relative to another sprite? I am using Kaboom.js,…
Ash Hanson
  • 23
  • 3
1
vote
2 answers

How to play background music in KaboomJS

I am making a game with the kaboom library and would like to add background music, i read the docs and found const music = play("music"); music.loop() but this seems to only play it once, the file is an MP3 file and i dont get any errors
Henry
  • 11
  • 4
1
vote
1 answer

Is there a way to merge multiple tiles in a level - Kaboom JS

When making a level in kaboomJS with a large tile map collisions, things start to get slow... So I was wondering if there was an easy way to merge multiple tiles like maybe a whole row of blocks could be treated as one large block?
Zachiah
  • 1,750
  • 7
  • 28
1
vote
1 answer

Kaboom - Is there an equivalent of the grounded() attribute for touching a wall?

I'm trying to make it so that I can have a wall jump in my game, is there a way to check if an object is touching the side of another physics object similar to the .grounded() attribute?
MrToenails
  • 371
  • 1
  • 9
1
vote
2 answers

Is there a way to resize a Kaboom game when the window is resized

Consider the following simple kaboom "game": kaboom(); function makeWallComps(name, x, y, w, h) { return [ name, "wall", origin("center"), rect(w, h), pos(x, y), outline(), area() ]; } let leftWall =…
Paul Wheeler
  • 18,988
  • 3
  • 28
  • 41
1
vote
4 answers

cannot load sprites outside of replit using kaboomjs

I have been working on a small game for fun these past few days using the kaboomjs library and it's working as expected when I'm writting and running it from replit, but if I try to run it using live server in vs code I keep getting failed to…
GNUk
  • 13
  • 3
0
votes
0 answers

how can I set Camera Limits in Kaboom.js?

I've looked around the kaboom.js docs, but I haven't yet found a function similar to Phaser.js setBounds() How do I get the same effect for the camera in Kaboom.js
Vatsa Pandey
  • 583
  • 2
  • 12
1
2 3