You can now use hero instead of "self" or "this"!


#1

You can now use hero instead of “self” or “this”!

What does that mean?

Before, you used this.attack() in JavaScript and self.attack() in Python to tell your hero to attack. Now you can use hero.attack() in either language!

This applies to all cases where we previously used “this” or “self” - you can now use “hero” on moveRight/Left/Up/Down, attack/cleave/shield, findNearestEnemy, and any other method you’ve been using so far.

Why the change?

Switching our languages’ syntax from “this” and “self” to a unified “hero” will make it easier for users to understand what they’re programming from the very start. Using “this” or “self” may not be intuitive for all users, especially since they’ll be trying to learn a lot of syntax at the same time, too.

It also standardizes the aspect of controlling the “hero” across all languages so that users learning Python have an easier time learning JavaScript later, and vice versa.

Using “hero” also lets users more easily write sophisticated programs in a functional programming style. We are working on introducing more awesome programming techniques, like event listeners and callbacks, and moving functions earlier in the game. Along with this, users will program not just their heroes, but also their pets and even ogres in the upcoming shareable games programming levels! Moving to “hero” lets users more intuitively choose which object they are programming.

How does it affect classes?

If students are already writing code using “this” and “self”, they will not be required to learn new syntax right away. We’ll continue to support use of “this” and “self” for the foreseeable future – existing code they’ve already written will still be valid, and any new code students write that use “this” or “self” will still work.

However, going forward, you might start to see “hero” referenced in the API and help guides, instead of “self” and “this”. We’ll also be updating our teacher guides to reflect the changes.

We recommend that teachers direct their students to use “hero” after they finish the Course they’re currently on, so that students will be able to take advantage of all the new features we will be rolling out down the road.

Teachers can print out or share this image with your class as they transition from using “this” or “self” to using “hero”:


A Fine Mint - adveturer
#2

Don’t get me wrong, but the “poster” has an error – it says:

…although it was the other way round:

:thumbsup: :smile:


#3

Oops. :slight_smile:


#4

Thats cool :grinning::heart_eyes: I noticed that once i started sarven desert it told me to use hero instead of self. Now i know. cool.


#5

Oh, and one more thing…

Probably the interface should be updated, as it still says “self”:

Well, it applies only to Programmaticon V, so I guess it’s not a big deal :smile: