0
Why's it not working?
Why is this code not working? What did i do wrong in the javascript https://code.sololearn.com/W6ra2t7VK11n/?ref=app
10 ответов
+ 1
Roel Jy moet die kode wat besluit hoe om te beweeg skei van die kode wat besluit wanneer om te beweeg.
Yes, the if conditions shoul be seperate for when something should happen and how something should happen.
x y changes based on behaviour and behaviour changes when x y is a certain value.
It can be simplified to a state machine. Initial state is move right but when x >= 200 transition into move down state.
Your logic is flawed thou and I'll let you fix that you will notice it when you see it.
0
What's wrong?
0
look at the code:
its ment to do this
let the box go to right if a<1 and d>0
then set a to 1 and b to 0
and that with all of them so it will be an infinite loop
0
Roel a <1 and d>0 does not get executed because it is an else if. right >= 200 gets executed everytime because it is true.
0
Nommer101 what do you suggest me to use? (pls only tips, because its more fun and i learn more from it☺)
0
Roel Separate your movements from the behaviour. They are not related but they just depend on each other.
0
like with only if statements? im not that good at english, sorry for that
0
Nommer101 why'd you put that first part in dutch/belgium??
and why does it mean exactly the same as the second part? and why is your dutch/belgium grammer that bad
ok ill try to do that
0
Roel Its afrikaans that's why its so bad. Wanted to know if you could understand it. XD
0
Nommer101 i can, but its hard, because its not fully dutch
waarschiinlijk is het voor jou dan ook lastiger om deze text te begrijpen, omdat het nederlands is en niet afrikaans