Breaking Ball - how to change flying ball to another spawnable


#1

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))


#2

Please post your code properly. FAQ - Check Before Posting


#3

This is not necessary.
Indentation isn`t important.


#4

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


#5

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


#6

Which level is this?


#7

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


#8

Breaking ball, probably.