Ask coding questions

← Back to all posts
How to change the sprite in Kaboom.js
MushyAvocado

What I want is simple. I took the Kaboom.js platformer template and I'm learning from it. The ground always has grass on top, but I want it to change to a dirt block if it's below another block.

What I need is some way to change the sprite.

I tried grass.sprite = "dirt" and grass.spriteId = "dirt" and anything else I could think of that might possibly work. Does anyone know how to do it?

Thanks!

The code is at line 118

Answered by SixBeeps [earned 5 cycles]
View Answer
Voters
MushyAvocado
Comments
hotnewtop
SixBeeps

The D in spriteID is capitalized.

MushyAvocado

@SixBeeps I had a feeling it was an easy solution!

Thanks :)