
-----------------------------------
abu_alaile
Wed May 24, 2006 9:03 am

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.

-----------------------------------
Clayton
Wed May 24, 2006 9:20 am


-----------------------------------
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 :D

-----------------------------------

Wed May 24, 2006 3:18 pm

erm
-----------------------------------
If you mean making it move by itself, after you draw it, increase it's variable and redraw it. eg:


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:



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
Fri May 26, 2006 9:05 am

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
Fri May 26, 2006 10:36 am


-----------------------------------
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)

-----------------------------------

Fri May 26, 2006 4:09 pm


-----------------------------------
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
Tue May 30, 2006 9:38 am

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
Tue May 30, 2006 10:01 am


-----------------------------------
Read Vahnx's post.  He tells you what to do.  Stop spamming and making redundant posts like this.
