Impact ForumsLatest from the Impact Forums
Impact IRC ChatGet help from others on IRC
Impact Forums
Issue with variables
Posted May 18, 2013, 12:31 am — by
drhayes
Yup, that's not the case.
That variable is an instance variable of your class. You can only set it and use it from an instance of your class. When you try and do this:
There's no there there, if you know what I mean.
I don't know if it'll help you, but here's a link to Mozilla's documentation about objects in JS.
EntityBadGuy = ig.Entity.extend({ variable: 'catpants' });
That variable is an instance variable of your class. You can only set it and use it from an instance of your class. When you try and do this:
EntityBadGuy = ig.Entity.extend({ variable: 'catpants' }); this.variable = 'doggyhat';
There's no there there, if you know what I mean.
this has no value there since you're not within an instance of your EntityBadGuy class. init is run on an instance of your class and, thus. this.variable actually refers to the variable.I don't know if it'll help you, but here's a link to Mozilla's documentation about objects in JS.
Older Posts
-
Feature Request: Weltmeister Scrollable Tile Selector
-
Question: PixiJS as renderer?
-
Issue with variables
-
Problems with making enemy chase the player
-
Top Down RPG Style Tile Based Grid Movement
-
Basic enemy entity?
-
Problems with making enemy chase the player
-
Problems with making enemy chase the player
-
Problems with making enemy chase the player
-
ig.Class.extend() issue - "SCRIPT445: Object doesn't support this action "
-
Problems with making enemy chase the player
-
Check for two mouse presses, simultaneously
-
Parkour
-
Basic enemy entity?
-
Whats your background?
-
Gravity
-
Top Down RPG Style Tile Based Grid Movement
-
Problems with making enemy chase the player
-
Problems with making enemy chase the player
-
How do I use this.angleTo( other ) ?
