1 decade ago by sohn
Hi.
I'm involved in endless-scrolling project with random map/collision generation.
'Drop' taught me a lot of things, of course.
Thank you, Dominic :)
I think the most clever part of it is,
// Do we need a new row?
if( this.screen.y > 40 ) {
// Move screen and entities one tile up
this.screen.y -= 8;
for( var i =0; i < this.entities.length; i++ ) {
this.entities[i].pos.y -= 8;
}
// Delete first row, insert new
this.map.shift();
this.map.push(this.getRow());
...
}
in the update function of 'drop.js'
However, what if we want to add some background & entities with their own scrolling/moving factor (distance or velocity) ?
I found that [ this.entities[i].pos.y -= (tileSize); ] is not enought to treat them.
Is there anybody who has a clue for that?
Thank you for your kindness.
I'm involved in endless-scrolling project with random map/collision generation.
'Drop' taught me a lot of things, of course.
Thank you, Dominic :)
I think the most clever part of it is,
// Do we need a new row?
if( this.screen.y > 40 ) {
// Move screen and entities one tile up
this.screen.y -= 8;
for( var i =0; i < this.entities.length; i++ ) {
this.entities[i].pos.y -= 8;
}
// Delete first row, insert new
this.map.shift();
this.map.push(this.getRow());
...
}
in the update function of 'drop.js'
However, what if we want to add some background & entities with their own scrolling/moving factor (distance or velocity) ?
I found that [ this.entities[i].pos.y -= (tileSize); ] is not enought to treat them.
Is there anybody who has a clue for that?
Thank you for your kindness.