Search the Community
Showing results for tags 'placement'.
Found 2 results
Hey, I'm trying to practice the phaser framework (and programming in general) by trying to recreate a doodle jump/papi jump game. I have the little ball jumping, enemy on the screen with collision detection and all the platforms being recycled once they die, however I have not been able to recycle (or even place) my enemies on the platforms. Because the platforms are not fixed I can't simply say ( x, y) cause the platform won't always be there. I tried: enemy = game.add.sprite( game.platform.centerX, game.platform.centerY, 'enemy' ); but to no avail. Am I on the right track? or not even close? Has anyone ever had the same problem and just overcome it in a different way, like creating a platform with an enemy on it by itself, and that entire sprite being its own class that's called on via a timer delay? Hopefully this is not too n00by of a question. Tips or directing me to resources are all helpful. Just trying to kill my 'hero', guys(and gals).. thanks again!
mauticom posted a topic in Phaser 2Hi guys, how do you place items(sprites) randomly on your world and ensure that they don't overlap with other already excisting items? Do you check every item or are there functions from the physic engines that support you with that? If there are no built in functions I would do it the following way: 1.) create random placement of sprite 2.) check newly placed items against all excisting items in the world 2.1) No overlapping -> GREAT finish! 2.2) If it overlaps repeat step 1. (abort after X cycles to avoid endless loop and performance spikes if you place them while the game runs) If you do it like this: is there are a global phaser list where I can loop through: a.) all excisting sprites b.) all visible sprites ??? Any other ideas and strategies to place items randomly? Thanks and greetings from a sunny Vienna, Clemens