Chris Knott
08/08/2020, 12:53 PMChris Knott
08/08/2020, 12:55 PMX# = NEWXVALUE(X#, A#, 1.5)
Which is equivalent to X# = X# + cos(A#) * 1.5
I wanted to expand the example to include a second character controller by WASD. To do this I copypasted all the code, then went through and edited it.
The second character I made to have the variables XX# and ZZ#. I could get it set up ok, because I understood the initialization lines like
X# = 100
Z# = 100
I changed these to
XX# = -100
ZZ# = -100
But when I came to edit X# = NEWXVALUE(X#, A#, 1.5)
, I chaged it to XX# = NEW*XX*VALUE(XX#, AA#, 1.5)
.
That is, I had confused the 'X' inside the function name "NEWXVALUE" as equivalent to the 'X' in the variable name X#.opeispo
08/08/2020, 12:58 PMChris Knott
08/08/2020, 1:01 PMFOR X# in 1 TO 10
FOR Y# in 1 TO 10
(do some stuff)
NEXT Y#
NEXT X#
I was writing;
FOR X# in 1 TO 10
FOR Y# in 1 TO 10
(do some stuff)
NEXT X# <---
NEXT Y#
which seemed much more natural to me. I just learnt to reverse them as a silly quirk of the language, it was only much later I realised that "there's no such thing as a 2d loop", and the inner loop "doesn't know" it's inside another loop.
Such an error is impossible in Python or C, due to the syntax, but I wonder if the same underlying misunderstanding is there, or whether the syntax helps learners realise straight away my revelation.Maikel
08/08/2020, 1:20 PMKartik Agaram
self
and cls
args.Chris Knott
08/08/2020, 2:48 PMimport *
which seemed like a real break of "the rules" to me.Maikel
08/08/2020, 3:30 PM