Nova
heroCharacter("Nova", 100, 25)Lecture 6 · Objects and classes
Edit the class. Create your character.
Escape the sentries.
Your code
Loading the starter code
These rules belong to every Character.
character.pyGive each character its own name, health and power.
__init__ method.You control hero. The sentries move automatically.Run mission creates three fresh objects. Edits are saved in this browser.
Ctrl or ⌘ + Enter runs your code. Tab indents. Esc then Tab leaves the editor.
Change the hero constructor call, then run the mission and inspect the three objects.
The hero changes while the two sentries keep their own constructor values.
Run the mission to create your objects.
Collect every power cell and reach the portal. You decide whether to dodge or fight.
LIVE SIMULATION↑←↓→or WASD
Walk into a sentry to attack. A red warning means it will attack next turn if you stay beside it.
Run the mission to create your hero and the two sentries.
All three come from the same class. Constructor arguments customize each object.
heroCharacter("Nova", 100, 25)guard1Character("Rust", 45, 14)guard2Character("Bolt", 60, 18)What your code just did
Each character is a separate object. A method call changes the object it receives.
Run the mission to beginYour Python has not run yet
Back to the lecture
Follow the original character example in the walkthrough, or run the practice problems in the notebook.