peteblank Posted December 12, 2018 Share Posted December 12, 2018 hey sorry for the n00b question, but I'm stuck. function changeBlock (player, blocks) { if (player.y>blocks.y+40) { coin.create(block.x,block.y-40,'coin'); this.sound.play('brick'); blocks.destroy(); } } I got the player to be able to destroy the block when it jumps below it. But what I want is for the block to change sprite to the dud block and create a coin on top. Link to comment Share on other sites More sharing options...
B3L7 Posted December 12, 2018 Share Posted December 12, 2018 If you are using separate textures for each sprite you can use blocks.setTexture('dud'); If you are using a texture with multiple sprites in it you can use blocks.setFrame('dud'); Then you can check at the start of the function against the texture or frame name to see whether to spawn a coin on collision. Hope that helps. Link to comment Share on other sites More sharing options...
peteblank Posted December 14, 2018 Author Share Posted December 14, 2018 Thank you but I had already solved it. Link to comment Share on other sites More sharing options...
Recommended Posts