Students can now use hero in their code!


#1

Students can now use hero in their code!

What does that mean?
Before, your students used this.attack() in JavaScript and self.attack() in Python to tell their hero to attack. Now they can use hero.attack() in either language!

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

Why the change?

Switching our Course languages’ syntax from “this” and “self” to a unified “hero” will make it easier for students to understand what they’re programming from the very start. Using “this” or “self” may not be intuitive for all students, 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 students learning Python have an easier time learning JavaScript later, and vice versa.

Using “hero” also lets students 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, students will program not just their heroes, but also their pets and even ogres in the upcoming shareable games programming levels! Moving to “hero” lets them more intuitively choose which object they are programming.

How does it affect my classes?

If your 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, your students 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 teaching your students to use “hero” after they finish the Course you’re currently on, so that your students will be able to take advantage of all the new features we will be rolling out down the road.

Print or share this image with your class as they transition from usingthisorselfto usinghero”: