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

Username:   Password: 
 RegisterRegister   
 Why Wont This Exit!?!?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jayman




PostPosted: Thu May 31, 2007 12:52 pm   Post subject: Why Wont This Exit!?!?

im trying to make a simple game...im at the beginning and for some reason i cant solve this simple problem...
at a random time the light should turn brightred.....for some reason i cannot get it to change to brightred at a certain point...
also im trying to reverse the direction of the car when it gets to the end...i put (-) infront of the x values but it didnt work so something must be wrong.

[Code]
var count:real
count:=0



setscreen ("graphics")
var a,b,c,e,g,h :int
a:=10
b:=60
c:=10
e:=60
g:=30
h:=55
var t :int
randint(t,1,5)


drawfillbox (maxx div 2-30,maxy div 2,maxx div 2+30,maxy div 2+120,grey)


loop

count:=count+.01
locate(1,1)
put count
put t
a:=a+1
b:=b+1
c:=c+1
e:=e+1
g:=g+1
h:=h+1
drawfillbox (a,10,b,30,green)
drawfilloval(c,10,10,10,black)
drawfilloval (e,10,10,10,black)
drawfillbox (g,30,h,40,black)
drawfilloval(maxx div 2,maxy div 2+20,15,15,red)
drawfilloval(maxx div 2,maxy div 2+58,15,15,yellow)
drawfilloval(maxx div 2,maxy div 2+95,15,15,green)
delay(10)
drawfillbox (a,10,b,30,white)
drawfilloval(c,10,10,10,white)
drawfilloval (e,10,10,10,white)
drawfillbox (g,30,h,40,white)





end loop
if t>=count then

drawfilloval(maxx div 2,maxy div 2+20,15,15,blue)
end if

[end Code]
Sponsor
Sponsor
Sponsor
sponsor
carGUY17




PostPosted: Thu May 31, 2007 7:53 pm   Post subject: Re: Why Wont This Exit!?!?

Here you go this is the program i made it might help you out the problems are all fixed
carGUY17




PostPosted: Thu May 31, 2007 7:53 pm   Post subject: Re: Why Wont This Exit!?!?

game file


cargame.t
 Description:

Download
 Filename:  cargame.t
 Filesize:  1.81 KB
 Downloaded:  120 Time(s)

carGUY17




PostPosted: Thu May 31, 2007 7:54 pm   Post subject: Re: Why Wont This Exit!?!?

pic file


car.bmp
 Description:
 Filesize:  5.96 KB
 Viewed:  1758 Time(s)

car.bmp


jayman




PostPosted: Fri Jun 01, 2007 11:16 am   Post subject: RE:Why Wont This Exit!?!?

okay so if i do it this way....i need help knowing how to put use the picture for it to work....

when i run thr program..i get : illegal picture ID number '0'. (Probable cause: picture was not successfully created.).

Help please!
jayman




PostPosted: Fri Jun 01, 2007 11:56 am   Post subject: Re: Why Wont This Exit!?!?

import GUI

setscreen("graphics")

var font1 :int
font1 := Font.New ("Comic sans :30:bold")
Font.Draw ("Welcome",maxx div 2-100, 370, font1,green)
delay(500)
font1 := Font.New ("Comic sans :20:bold")
Font.Draw ("to",maxx div 2-70, 300, font1,blue)
delay(1000)
font1 := Font.New ("Comic sans :55:bold")
Font.Draw ("HIT-THE-BRAKES",maxx div 2-300, maxy div 2, font1,black)

%%%%%%THE CONFETTI PROGRAM
var count:=0
loop
var x,y,c :int
count:=count+1
randint(x,0,maxx)
randint(y,0,maxy)
randint(c,blue,yellow)
drawdot (x,y,c)
exit when count =250000
end loop
cls

drawfillbox(0,0,maxx,maxy,brightred)
colourback(brightred)
colour (white)
font1 := Font.New ("Comic Sans :30:bold")
Font.Draw ("Instructions",maxx div 2-120, 370, font1,white)

locate(10,1)
put "Are you ROAD WORTHY"
delay (1000)
put "Are you someone that will get busted by the cops?"
delay (2000)
put "You want to prove to your parents you arn't a sped and can react fast"
delay (2000)
put " "
put" "
put "Hit the breaks by pressing 'b'"
put "If you're to slow, you will get busted"
put ""
put""
put ""
put""
put "Press 'LETS PLAY' to begin the test..."

procedure rungame
cls
drawfillbox(0,0,maxx,maxy,brightblue)
var timer:real
timer:=0
var a,b,c,e,g,h :int
a:=10
b:=60
c:=10
e:=60
g:=30
h:=55
var t :int
var redlight :boolean:=false
randint(t,1,5)


drawfillbox (maxx div 2-30,maxy div 2,maxx div 2+30,maxy div 2+120,grey)


loop

timer:=timer+.01
locate(1,1)
put timer
put t
a:=a+1
b:=b+1
c:=c+1
e:=e+1
g:=g+1
h:=h+1
drawfillbox (a,10,b,30,green)
drawfilloval(c,10,10,10,black)
drawfilloval (e,10,10,10,black)
drawfillbox (g,30,h,40,black)
drawfilloval(maxx div 2,maxy div 2+20,15,15,green)
drawfilloval(maxx div 2,maxy div 2+58,15,15,yellow)
drawfilloval(maxx div 2,maxy div 2+95,15,15,red)
delay(10)
drawfillbox (a,10,b,30,brightblue)
drawfilloval(c,10,10,10,brightblue)
drawfilloval (e,10,10,10,brightblue)
drawfillbox (g,30,h,40,brightblue)

if t = count then
redlight:=true
drawfilloval(maxx div 2,maxy div 2+95,15,15,brightred)
end if
if h=maxx then
a:=a-1
b:=b-1
c:=c-1
e:=e-1
g:=g-1
h:=h-1
end if
end loop



end rungame
var button:int:=GUI.CreateButton (maxx div 2-30,3,60,"LETS PLAY", rungame)
loop exit when GUI.ProcessEvent
end loop
carGUY17




PostPosted: Fri Jun 01, 2007 8:05 pm   Post subject: Re: Why Wont This Exit!?!?

ok when u download the pic change the name of the file just to car
jayman




PostPosted: Mon Jun 04, 2007 12:25 pm   Post subject: Re: Why Wont This Exit!?!?

yea if i change the name of the car file to just 'car'..it wont run the file...i tried to change 'car' to car.bmp and that wont work either
Sponsor
Sponsor
Sponsor
sponsor
jayman




PostPosted: Mon Jun 04, 2007 12:32 pm   Post subject: Re: Why Wont This Exit!?!?

i also just tried drawing my own car in paint and saved it as car but the program still wont work properly
jayman




PostPosted: Tue Jun 05, 2007 9:14 pm   Post subject: I REALLLY DESPERATELY NEED HELP ..STILL cant figure this out

so pretty much i havnt advanced in the drawing it in paint and im trying to stick to my original way cuz i understand that...ive started experimenting with time but still cant get it to exit at a random time....this is due by the end of the week:( PLZ help
jayman




PostPosted: Wed Jun 06, 2007 6:49 pm   Post subject: Can no one solve this!?!

is this not possible:|
jayman




PostPosted: Thu Jun 07, 2007 6:32 pm   Post subject: Re: Why Wont This Exit!?!?

nvm i got it to turn brightred
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  [ 12 Posts ]
Jump to:   


Style:  
Search: