Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Movement problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Barda4




PostPosted: Tue Feb 20, 2007 4:29 pm   Post subject: Movement problem

Ok I am having trouble getting my guy to move. I have it in the processes that he is supposed to move but he doesn't. What happens is he actually get onto the screen but he doesn't move. I believe that turing isn't reading the key input plz help me i need it I am way over my head with this. Here the code

var chars : array char of boolean
loop
Input.KeyDown (chars)
end loop
if chars (KEY_RIGHT_ARROW) then
fork linkwalkright
chright := true
chleft := false
chup := false
chdown := false
elsif chars (KEY_LEFT_ARROW) then
fork linkwalkleft
chleft := true
chright := false
chup := false
chdown := false
elsif chars (KEY_UP_ARROW) then
fork linkwalkup
chup := true
chright := false
chleft := false
chdown := false
elsif chars (KEY_DOWN_ARROW) then
fork linkwalkdown
chdown := true
chright := false
chleft := false
chup := false
end if
Sponsor
Sponsor
Sponsor
sponsor
CodeMonkey2000




PostPosted: Tue Feb 20, 2007 10:40 pm   Post subject: Re: Movement problem

Put the end loop at the end of your code. Like so:
Turing:
var chars : array char of boolean
loop
    Input.KeyDown (chars)
    if chars (KEY_RIGHT_ARROW) then
        fork linkwalkright
        chright := true
        chleft := false
        chup := false
        chdown := false
    elsif chars (KEY_LEFT_ARROW) then
        fork linkwalkleft
        chleft := true
        chright := false
        chup := false
        chdown := false
    elsif chars (KEY_UP_ARROW) then
        fork linkwalkup
        chup := true
        chright := false
        chleft := false
        chdown := false
    elsif chars (KEY_DOWN_ARROW) then
        fork linkwalkdown
        chdown := true
        chright := false
        chleft := false
        chup := false
    end if
end loop

Didn't you already ask this?
BenLi




PostPosted: Tue Feb 20, 2007 11:23 pm   Post subject: RE:Movement problem

and just a note i think you'd have a much easier time seeing a simple problem like that if you indent your code, and its turing so just press F2
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: