PhasedEvolution Posted September 28, 2016 Share Posted September 28, 2016 Hello. I have created a function that instances a sprite giving attributes such as phyisics and size , etc. In the end of the function I kill the sprite. I put a keyboard input that when clicked resets that sprite to the given coordinates. I am using the isometric plugin. However the reset happens the sprite image doesn't appear. I see the body if I debug it. However no collision is happening as well. I only see the cube. If I spawned it normally the image sprite image would appear and I could collide with it. Any idea my sprite has no image and seems to don't collide with anything? Probably it is something related to phaser in general and not with the iso plugin Link to comment Share on other sites More sharing options...
lumoludo Posted September 29, 2016 Share Posted September 29, 2016 If you are calling kill() on it, are you calling revive() on it when you want to use it again? PhasedEvolution 1 Link to comment Share on other sites More sharing options...
PhasedEvolution Posted September 29, 2016 Author Share Posted September 29, 2016 15 hours ago, lumoludo said: If you are calling kill() on it, are you calling revive() on it when you want to use it again? No ^^ I didn't even know it existed really. Thank you. I thought reset was already responsible for reviving... Can I specify coordinates where to revive ? I could specify them when using reset... I have this code. I can spawn it again but after spawning once it doesnt reset its position to the new position ( my dude.body position changes)... function chair_wall () { chair_wall = game.add.isoSprite(200,200,0,'chair_wall',0,random_sprites_group); game.physics.isoArcade.enable(chair_wall); chair_wall.body.collideWorldBounds = true; chair_wall.kill(); } chair_wall(); //assigned a button to spawn it after when needed add_chair_wall.onDown.add (function () { // I tried checking if it is alive and killing if it is and then reset chair_wall.reset(dude.body.x,dude.body.y,0); }) Link to comment Share on other sites More sharing options...
lumoludo Posted September 30, 2016 Share Posted September 30, 2016 I don't think so. Functions should really only be meant to do one thing, and revive()'s job is just to bring a kill()'ed object back into existence. You should be able to just set the X and Y coordinates manually after you revive it, or if you wanted to, you could write your own function to revive() and set the position of a sprite. Link to comment Share on other sites More sharing options...
Recommended Posts