+ 14

Something is goin wrong in my code plis help

I have a problem in code that ever time a press a button it executes the function of the button I press before, when I press it again then executes the function that it supose plis help me.The code name is game and its on my profile. Tengo un problema en mi codigo que cada vez que pressiono un botton se ejecuta la funcion del ultimo botton que presione antes que el y cuando lo presiono otra ves entonces executa la funcion que le pertenese.Por favor ayuda.El codigo se llama game y esta en mi perfil.

23rd Nov 2016, 1:43 PM
Fabian Nieves
Fabian Nieves - avatar
6 Réponses
+ 11
English is not my native language. could you give me a example?
23rd Nov 2016, 4:01 PM
Fabian Nieves
Fabian Nieves - avatar
+ 11
oh thanks I will test it
23rd Nov 2016, 5:08 PM
Fabian Nieves
Fabian Nieves - avatar
+ 4
in the function L U R what you do is draw rectangle with previous xpos ypos and then .changes. it so code seems a step behind your function should change the values before it is xpos ypos
23rd Nov 2016, 4:01 PM
Sandeep Chatterjee
+ 3
copied your function for going left function L(){ d.save() d.clearRect( 0, 0, 300, 300); cube(xpos,ypos) d.restore(); if(xpos != 280){ xpos = xpos +10; } } should be function L(){ d.save() d.clearRect( 0, 0, 300, 300); if(xpos != 280){ xpos = xpos +10; } cube(xpos,ypos) d.restore(); } not completely sure if "d.restore()" should move but "cube(xpos,ypos)" need to move
23rd Nov 2016, 4:09 PM
Ethan
Ethan - avatar
+ 1
in each movement function the line: cube(xpos,ypos) should come after u change xpos or ypos instead of before (after the 'if' u have there instead of before)
23rd Nov 2016, 3:41 PM
Ethan
Ethan - avatar
+ 1
Where is the code?
15th Aug 2017, 12:25 PM
Iwan
Iwan - avatar