How do i make an uploaded picture in turing move by itself?
Author |
Message |
Ldomi
|
Posted: Wed Jan 03, 2007 5:40 pm Post subject: How do i make an uploaded picture in turing move by itself? |
|
|
Im trying to make a racing game where a picture of a car I uploaded is supposed to move by itself, but i dont the commands that make a picture move.
I already tried adding "+1" to its coordinates and using the delay command...but that doesn't seem to work.
Can anyone help me?
Thank you in advance =) |
|
|
|
|
|
Sponsor Sponsor
|
|
|
neufelni
|
Posted: Wed Jan 03, 2007 5:58 pm Post subject: (No subject) |
|
|
You need to have variables to represent the coordinates of the picture. You then need a loop in which you will change the variables and then redraw the picture. Sort of like this:
code: | var x, y := 0
loop
Pic.Draw("car.bmp", x, y, picCopy)
x := x + 1
cls
end loop
|
|
|
|
|
|
|
Ldomi
|
Posted: Wed Jan 03, 2007 10:30 pm Post subject: (No subject) |
|
|
Thank you very much, but now the other car that is controlled by the user (using the getch command) doesnt move. How do i get them to work at the same time? |
|
|
|
|
|
neufelni
|
Posted: Wed Jan 03, 2007 11:00 pm Post subject: (No subject) |
|
|
Use Input.KeyDown |
|
|
|
|
|
BenLi
|
Posted: Thu Jan 04, 2007 10:38 am Post subject: (No subject) |
|
|
You've asked vague questions, and Nick was nice enough to answer them with equally vague answers. Please post some source code so we can actually help you. |
|
|
|
|
|
Ldomi
|
Posted: Thu Jan 04, 2007 1:22 pm Post subject: (No subject) |
|
|
BenLi wrote: You've asked vague questions, and Nick was nice enough to answer them with equally vague answers. Please post some source code so we can actually help you.
ok, here's my code so far:
code: | %Set screen up
setscreen ("nocursor")
setscreen ("noecho")
setscreen ("offscreenonly")
%Declartion section
var startpointy : int := 150
var startpointy2: int := 400
var startpointx, endpointx, endpointy : int := 0
var endpointy2: int :=450
var y : int := 10
var x: int :=50
%var pictureID : int
var key : string (1)
var mainWin := Window.Open ("position:130;30,graphics:800;600")
%Procedure section
proc title
cls
locate (1, 35)
put "Racing Game"
end title
%Proc displayPic
procedure displayPic
var pictureID : int := Pic.FileNew ("BG.JPG")
Pic.Draw (pictureID, 0, 0, picCopy)
pictureID := Pic.FileNew ("P1.jpg")
%drawfillbox (startpointx,startpointy,endpointx+700, endpointy+640,white)
Pic.Draw (pictureID, startpointx + 1, startpointy + 1, picMerge)
getch (key)
if key = chr (200) and endpointy <= 300 then
startpointy := startpointy + 10
endpointy := endpointy + 10
elsif key = chr (208) and startpointy >= 90 then
startpointy := startpointy - 10
endpointy := endpointy - 10
elsif key = chr (205) and endpointx <= 630 then
startpointx := startpointx + 10
endpointx := endpointx + 10
else
if key = chr (203) and startpointx >= 1 then
startpointx := startpointx - 10
endpointx := endpointx - 10
end if
end if
pictureID:= Pic.FileNew ("Comp.jpg")
loop
drawfillbox (startpointx+1,startpointy2+1, endpointx+1,endpointy2+1,grey)
Pic.Draw (pictureID,startpointx,startpointy2,picMerge)
startpointx:= startpointx +10
delay (50)
end loop
View.Update
end displayPic
%Main Program
loop
displayPic
exit when key = chr (10) or key = chr (27)
end loop
|
(sorry, but i don't think you'll be able to see the pictures) |
|
|
|
|
|
Ldomi
|
Posted: Thu Jan 04, 2007 1:42 pm Post subject: (No subject) |
|
|
Nick wrote:
Ill try to learn that command. Thank you very much |
|
|
|
|
|
|
|