henrikkee Posted October 14, 2015 Share Posted October 14, 2015 Hello, I'm doing a menu that is this: if(enterButton.isDown && player.x > 172 && player.x < 315){interfacel = game.add.image(50,100,'lojai')texto = game.add.text(360,160, "Loja", estilot);cvidas = game.add.button(100,240,'lojao',this.comprouvida,this,1,0);coracao = game.add.sprite(120,260,'sprites','coracao1');cescudo = game.add.button(100,350,'lojao',this.comprouescudo,this,1,0);escudop = game.add.sprite(120,370,'sprites','escudo')tvidas = game.add.text(180,260, "Comprar uma vida 10", estilot);tescudo = game.add.text(180,370, "Comprar um Escudo 6", estilot);voltar = game.add.button(500,520,'voltar',this.fecharloja); }and if i click in that button ''voltar'' i put that will destroy like this:interfacel.destroyor thatinterfacel.killbut none of them disappear with the images how can i do that? Link to comment Share on other sites More sharing options...
MattMcFarland Posted October 14, 2015 Share Posted October 14, 2015 Hmm.. I can't tell for sure, but it looks like you are creating a bunch of them every time the key is pressed? Link to comment Share on other sites More sharing options...
henrikkee Posted October 14, 2015 Author Share Posted October 14, 2015 Hmm.. I can't tell for sure, but it looks like you are creating a bunch of them every time the key is pressed? Well, yes that was the problem, thanks Link to comment Share on other sites More sharing options...
Recommended Posts