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

Username:   Password: 
 RegisterRegister   
 How can I move my truck .
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
abu_alaile




PostPosted: Wed May 24, 2006 9:03 am   Post subject: How can I move my truck .

Hi My name is Sari,


I have a problem with moving my truck to: forward, backward, left and right.

Please if you have a solution for my problem , please tell.


Thank You.
Sponsor
Sponsor
Sponsor
sponsor
Clayton




PostPosted: Wed May 24, 2006 9:20 am   Post subject: (No subject)

welcom to compsci, when you post a question plz give a detailed description of the problem you are facing, along with the code that you've tried, now, if you are asking what i think you are asking, all you need to do is change the coordinates that the truck is being drawn at right? so have a counter to change your coordinates, clear what you have already drawn (so the picture doesnt "smear") and redraw the truck at its new coordinates, ill leave the coding to you, when you run into a problem with that just post what youve got and well help you Very Happy
Guest




PostPosted: Wed May 24, 2006 3:18 pm   Post subject: erm

If you mean making it move by itself, after you draw it, increase it's variable and redraw it. eg:

code:

View.Set ("offscreenonly")
var x, y : int := 100

loop
    drawfilloval (x - 1, y - 1, 50, 50, white)
    drawfilloval (x, y, 50, 50, red)
    x += 1
    y += 1
    delay (50)
    View.Update
end loop


Or if you wish to move it manually:


code:

View.Set ("offscreenonly")
var x, y : int := 100
var key : array char of boolean

loop
    Input.KeyDown (key)
    if key (KEY_RIGHT_ARROW) then
        x += 1
    end if
    if key (KEY_LEFT_ARROW) then
        x -= 1
    end if
    if key (KEY_UP_ARROW) then
        y += 1
    end if
    if key (KEY_DOWN_ARROW) then
        y -= 1
    end if
    cls
    drawfilloval (x, y, 50, 50, red)
    delay (50)
    View.Update
end loop
abu_alaile




PostPosted: Fri May 26, 2006 9:05 am   Post subject: How can I move my truck by using keyboard directions

Hi my name Sari,


actsually i got your message , Thank you.


My problem still is how to my truck : farward, backward, right and left by using the keyboard directions bottoms:

For Example: if i want to play it as a game, i can control the truck by the using keyboard directions bottoms.



Than You
TheOneTrueGod




PostPosted: Fri May 26, 2006 10:36 am   Post subject: (No subject)

read vahnx's post. He tells you EXACTLY how to do that. All you have to do is implement it in your program (instead of drawfilloval, have a procedure called drawtruck and pass it those paramaters)
Guest




PostPosted: Fri May 26, 2006 4:09 pm   Post subject: (No subject)

Maybe post your truck. You have to move each thing you draw. If you draw like 2 ovals for the wheels, a rectangle for the body, and a square for the head, make each variable in the 'x' position and 'y' position moves when you press the corrisponding key.
abu_alaile




PostPosted: Tue May 30, 2006 9:38 am   Post subject: How can I move my truck bu using the keyboard directions

How can i move my truck by using the keyboard directios bottoms.


For example , if i want to play it as game by contronling my truck with the keyboard directions. Farward, backward, right and left.

Please help me .




Thank You
HellblazerX




PostPosted: Tue May 30, 2006 10:01 am   Post subject: (No subject)

Read Vahnx's post. He tells you what to do. Stop spamming and making redundant posts like this.
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: