We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Pretty much as title says, trying to run the object tutorial for python mode, but even after correcting indentation the sketch won't run and gives a nullpointer. EDIT removed picture, see sketch code & error message below.
Hopefully someone can tell me what's going on and how to fix it. Thanks!
Answers
Avoid code screenshots! Read below how to post them in this forum via markup: L-)
https://Forum.Processing.org/two/discussion/15473/readme-how-to-format-code-and-text
Any1 can see your code isn't properly indented at that code screenshot! 8-|
Also, where is the rest of its
class
block? :-\"Oh my bad, thought code wouldn't be necessary. Also, by properly indented I mean there're no more errors which say 'this line probably needs to be indented'. At any rate here's the code:
And here's the error message:
In method display() below, clearly only the
stroke(0)
statement is correctly indented in relation to its method. The other 3 statements are outside method display(): #-oSolution, indent the other 3 statements as well: ;;)
2nd bug, in class Car, only the __init__() constructor method is indented in relation to its
class
.The other 2 methods are indented in relation to __init__() instead of their
class
! @-)Solution, make all
def
aligned, so they're all indented in relation toclass
Car. B-)Extra æsthetic tip, skip 2 lines after each
def
block. And 3 for eachclass
block: :bzthanks a bunch! Apparently the error 'this line _probably _need to be indented' isn't all that helpful then? And admittedly I got annoyed by it. :-S :D
Thanks again!