Jump to content

Search the Community

Showing results for tags 'sprite group animation timer'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. In the Phaser examples there is 'Create Sprite in a group'. Here's the code: -------------------------------------------------------------- var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render }); function preload() { game.load.image('ufo', 'assets/sprites/ufo.png'); game.load.image('baddie', 'assets/sprites/space-baddie.png'); } var friendAndFoe; var enemies; function create() { // Create some local groups for later use. friendAndFoe = game.add.group(); enemies = game.add.group(); // You can directly create a sprite and add it to a group // using just one line. friendAndFoe.create(200, 240, 'ufo'); // Create some enemies. for (var i = 0; i < 8; i++) { createBaddie(); } // Tap to create new baddie sprites. game.input.onTap.add(createBaddie, this); } function createBaddie() { enemies.create(360 + Math.random() * 200, 120 + Math.random() * 200,'baddie'); } function render() { game.debug.text('Tap screen or click to create new baddies.', 16, 24); } ------------------------------- What if you wanted to add the same sprite 'the baddie' over and over again automatically in a fixed location, no button use, using a timer instead? Let's say, so it built up a horizontal row of baddies and then a vertical row of baddies, maybe one baddie every two seconds with a corresponding audio file (just a short beep), the same audio file over and over with each baddie being spawned. There's another example; 'Create if null' - creates a sprite every second. Something like the two examples combined??? Don't get me wrong, lots of examples there. Anyone have any ideas how one might do the above? Because I don't see any examples like what I'm describing, sprites, animations, fixed locations, timers, audio files, etc.
×
×
  • Create New...