Breaking Ball - how to change flying ball to another spawnable

Why is not possible to change flying-ball to potion-medium?

This works:

Now that the paddle is ready, we create the flying ball:

game.spawnXY(“flying-ball”, 40, 30)
game.setPropertyFor(“flying-ball”, “speed”, 30)
game.setPropertyFor(“flying-ball”, “rotation”, 0.8)

When the ball hits things, it defeats them:

game.setActionFor(“flying-ball”, “collide”, handler.defeatOther())

If it leaves the screen, it comes back to the center:

game.setActionFor(“flying-ball”, “exit”, handler.teleportTo(40, 40))

Each lost ball costs 20 points:

game.setActionFor(“flying-ball”, “exit”, handler.addScore(-20))

This don`t work :cry::

game.spawnXY(“potion-medium”, 40, 30)
game.setPropertyFor(“potion-medium”, “speed”, 30)
game.setPropertyFor(“potion-medium”, “rotation”, 0.8)
game.setActionFor(“potion-medium”, “collide”, handler.defeatOther())
game.setActionFor(“potion-medium”, “exit”, handler.teleportTo(40, 40))
game.setActionFor(“potion-medium”, “exit”, handler.addScore(-20))

Please post your code properly. FAQ - Check Before Posting

Sorry, I saw unproperly posted code so…
force of habbit, sorry.

Maybe it isn’t, but you need properly posted code so that it’s easier to understand.
hero.say("ducky's right!")

1 Like

Which level is this?

I don’t think the potion medium has a property to move or anything.

Breaking ball, probably.