Search the Community
Showing results for tags 'createmultiple'.
-
So I am preloading an atlasXML spritesheet game.load.atlasXML('sheet', 'images/sheet.png', 'images/sheet.xml'); and I can create a sprite using: game.add.sprite(game.world.centerX, game.world.centerY, 'sheet', 'playerShip1_orange.png'); I am trying not to use a for loop to create many sprites for a a sprite group I'm creating by using Group.createMultiple Now if I'm just loading a sprite or image, I can do this.meteorGrey = game.add.group(); this.meteorGrey.createMultiple(25, 'meteorGreyBig1.png'); Now when it's in a atlas sprite, this is where I'm running into trouble. this.meteorGrey = game.add.group(); this.meteorGrey.createMultiple(25, 'sheet', 'meteorGreyBig1.png'); It ends up displaying nothing
-
Hello & Thanks , I have 2 images (actually 4 in final code) named thruth01sprite and thruth02sprite . Rather than duplicate this code , I would like to group them: But I'm not having much luck in writing the group code: // All 40 of them bullets.createMultiple(10, 'bullet'); // bullet becomes bullets bullets.setAll('anchor.x', 0.5); bullets.setAll('anchor.y', 0.5); // bullets.body.velocity.y = -300; // bullets.body.acceleration.y = -300; // All 4 of them okGuys.createMultiple(2, ('truth01sprite','truth02sprite')); // truth01sprite becomes okGuys okGuys.setAll('anchor.x', 0.5); okGuys.setAll('anchor.y', 0.5); The bullets code works fine , but the okGuys no go . Pls, how can I do this properly ? Thanks
-
Hi, I'm creating a shooter game, and I've followed the 'Space Invaders' example. Everything is working but one thing, I would like to have infinite ammo, so CreateMultiple has to be infinite. It requires a value, so I don't know how to make it actually infinite. Basically what I want to do is create a couple bullets and recycle them over and over again. Any suggestions on how I could do so you never run out of bullets? Thanks in advance, Kevin
-
Hi gamers! I have a group in which some coins are created with createMultiple. When I start the game the player collisions with unexpected group of coins ... The score of the player increases, therefore the collision occurs, but is not physically collide ... Some code: this.coinlGroup = this.game.add.group(); this.coinGroup.createMultiple(70, 'coin'); this.coinGroup.forEach(setupCoinGroup, this); Greetings!