Jump to content

Search the Community

Showing results for tags 'turbo'.

  • 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. So I've got little to no time, but i really like TypeScript and Phaser and i've just make a small edit to one of the demos: var car: Phaser.Sprite; var miniCam: Phaser.Camera; var turbo: bool = true; var turboDuration: number = 5 * 1000; var turboCooldown: number = 20 * 1000;and then in the update function: if (myGame.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR)) { if (turbo) { var motion: Phaser.Point = myGame.motion.velocityFromAngle(car.angle, 600); car.velocity.copyFrom(motion); setTimeout(function () { turbo = false; setTimeout(function () { turbo = true; }, turboCooldown); }, turboDuration); } } So you can easily copy paste or just imagine the result. My question is do you think, there is a better approach also i tough for making turbo, turboDuration, turboCooldown properties of car but TypeScript doesn't like adding properties to objects later on like: car.turbo = false; Since compiler checks that car is of type Phaser.Sprite and that there isn't property "turbo" So share your ideas
×
×
  • Create New...