learngs2:variables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revisionBoth sides next revision
learngs2:variables [2023/02/24 12:46] twinnylearngs2:variables [2023/02/24 12:46] twinny
Line 21: Line 21:
   echo(this.greeting);   echo(this.greeting);
 } }
 +
  
 </code> </code>
Line 42: Line 43:
   this.object = player;   this.object = player;
 } }
 +
  
 </code> </code>
Line 49: Line 51:
 You may have noticed all variables so far have started with this. This creates the 'scope for the variable which defines where it exists and potentially for how long. There is a few we can use: You may have noticed all variables so far have started with this. This creates the 'scope for the variable which defines where it exists and potentially for how long. There is a few we can use:
  
-<code javascript>+<code>
 this.    - Refers to the current object (e.g. if we are writing this in a weapon, we are created a variable that exists and is accessible in the weapon) this.    - Refers to the current object (e.g. if we are writing this in a weapon, we are created a variable that exists and is accessible in the weapon)
 thiso.   - Refers thiso.   - Refers
Line 59: Line 61:
  
 This is likely very confusing but again, it will make sense the more you learn and practise with the concepts coming in these lessons! This is likely very confusing but again, it will make sense the more you learn and practise with the concepts coming in these lessons!
 +
  
 </code> </code>
  • learngs2/variables.txt
  • Last modified: 2023/02/24 12:47
  • by twinny