reviving killed ledges with new X and Y coordinates

Recommended Posts

Hi, so I'm trying make a doodle jump type of a game , so far I've created the infinity world and added 6 ledges. now I want to kill and revive the ledges with the new X and Y coordinates, but somehow can't get it to work. I've managed to kill the ledges as they go out of camera bounds by using (forEachAlive)but got issues with reviving them. I've tried getFisrtDead and reset but nope, cant get it to work. Does anyone know how I could solve this? 


so this is how I create the platforms: 

generatePlatforms: function(){
//grouping the platforms
platformPool =;
platformPool.enableBody = true;
var ground = game.add.sprite(0, -32 ,'ground' );
ground.body.immovable = true;
for (var i= 0; i < 6; i++){
var randomX =game.rnd.integerInRange(0, -50);
var randomY = -100 *i;
ledge = game.add.sprite(randomX,randomY,'ground');
ledge.body.immovable =true;

 and this is how I kill the ledges under the update function: 

var platformYMin = el.y;
if(el.inCamera == false){
} },this);

Thanks in advance 

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.