Jump to content

Search the Community

Showing results for tags '#typescript'.

  • 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. Anther WTF moment with Typescript. It is similar to a previous problem I had, but doesn't have the same solution. Could someone explain this, please? module TestGame{export class StateSettingStage extends Phaser.State { sally: TargetSprite; //subclass of Phaser.Sprite shoes: Token; //subclass of Phaser.Sprite this.sally = new TargetSprite(this.game, 350, 20, "sally"); this.game.add.existing(this.sally); this.shoes= new TargetSprite(this.game, 350, 20, "shoes"); this.game.add.existing(this.shoes); ->this.shoes.setTargetSprite(this.sally); <--- No problem this.clothes.children.forEach(function (val: Token) { val.anchor.setTo(0.5, 0.5); //val.setTargetSprite(this.sally); <-- this is what I really wanted to do, but...-> this.shoes.setTargetSprite(this.sally); <-- this.shoes and this.marry are undefined! }) }}Why are "shoes" and "sally" undefined when within the foreach callback function? I checked, and there is no argument I can use to pass these variables to the callback function (not that I should need to anyway, because they are within scope!)
×
×
  • Create New...