:: Race Game ::
Author |
Message |
MiX-MaztA-M8riX
|
Posted: Fri Nov 26, 2004 12:25 pm Post subject: :: Race Game :: |
|
|
I Was trying to go for that old school feel, with the over the top - view. I dunno how to get the drifting goin on after you let go of the direction you wanna go, its really.. REALLY REALLY basic right now I think but hey, its just the main thing, if anyone wants to improve on it go straight ahead, I need the help
code: |
setscreen ("graphics:600;400,position:center;center")
var font1 : int
var keys : array char of boolean
var x, y : int
var laps : int := 5
var check : int := 0
var yes : int := 1
font1 := Font.New ("Arial :20")
x := 230
y := 25
%% Graphics
colorback (255)
cls
%Start/Finish Line
Draw.Line (190, 30, 190, 0, 68)
%Checkpoint Line
Draw.Line (190, maxy - 25, 190, maxy - 68, 72)
%Borders
Draw.Line (1, 1, maxx, 1, 79)
Draw.Line (maxx - 1, maxy - 21, maxx - 1, 0, 79)
Draw.Line (1, maxy - 21, 1, 21, 79)
Draw.Line (1, maxy - 25, maxx - 1, maxy - 25, 79)
%Track Outline
Draw.Line (75, 30, 500, 30, 0)
Draw.Line (500, 30, 500, 180, 0)
Draw.Line (500, 180, 350, 180, 0)
Draw.Line (350, 180, 350, 280, 0)
Draw.Line (425, 230, maxx, 230, 0)
Draw.Line (350, 280, 500, 280, 0)
Draw.Line (500, 280, 500, 330, 0)
Draw.Line (500, 330, 75, 330, 0)
Draw.Line (75, 330, 75, 30, 0)
Draw.Fill (100, 80, 8, 0)
%% Procedures
%Draw Piece
procedure Char
Draw.FillBox (x, y, x + 10, y + 5, 10)
end Char
%Get Keys
procedure Keys
Input.KeyDown (keys)
if keys (KEY_RIGHT_ARROW)
then
x += 1
delay (10)
elsif keys (KEY_LEFT_ARROW)
then
x -= 1
delay (10)
elsif keys (KEY_UP_ARROW)
then
y += 1
delay (10)
elsif keys (KEY_DOWN_ARROW)
then
y -= 1
delay (10)
end if
end Keys
procedure AllElse
%Collision Detection
if whatdotcolour (x + 5, y + 5) = 8
or whatdotcolour (x + 10, y) = 8
or whatdotcolour (x - 1, y) = 8
or whatdotcolour (x + 5, y + 5) = 0
or whatdotcolour (x + 10, y) = 0
or whatdotcolour (x - 1, y) = 0
then
Font.Draw ("YOU CRASHED!", maxx div 5, maxy div 2, font1, 15) %<-Tells User They Crashed
Input.Pause
Font.Draw ("YOU CRASHED!", maxx div 5, maxy div 2, font1, 8) %<-Write Over In Grey
Font.Draw ("GAME OVER!", maxx div 5, maxy div 2, font1, 255) %<-Show Its Game Over
Input.Pause
quit
end if
%Lap Counter
if whatdotcolour (x + 12, y) = 68
then
laps -= 1
Text.Locate (1, 1)
color (10)
put "Only ", laps, " Laps To Go!"
delay (300)
color (255)
put "Only ", laps, " Laps To Go!"
end if
%If Laps Are 0 Then...
if laps = 0
then
Font.Draw ("You Won!", maxx div 5, maxy div 2, font1, 255)
Input.Pause
quit
end if
%Need These ReDrawn
Draw.Line (190, maxy - 25, 190, maxy - 68, 72)
Draw.Line (1, maxy - 25, maxx - 1, maxy - 25, 79)
end AllElse
%%% Game Loop
loop
Char
Keys
AllElse
end loop
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Viper
|
Posted: Fri Nov 26, 2004 12:38 pm Post subject: (No subject) |
|
|
wow thats pretty kool but you should have it not leave the big green line(just have a black one follow it so the black one will jeave the line and not the green one) |
|
|
|
|
|
Neo
|
Posted: Fri Nov 26, 2004 5:13 pm Post subject: (No subject) |
|
|
I did 4 laps in less than 3 seconds by going backwards then forwards over the finish line.... . Not quite a racing game yet, but its alrite.. |
|
|
|
|
|
MiX-MaztA-M8riX
|
Posted: Tue Nov 30, 2004 11:45 am Post subject: (No subject) |
|
|
I Got An Update
code: | setscreen ("graphics:600;400,position:center;center")
var font1 : int %<- Font Variable
var keys : array char of boolean
var x, y : int %<-Cirlces Co-ordinates
var laps : int := 0 %%<- Change This For How Many Laps
var check : int := 0 %<- Checks If You Have Gone Over Checkpoint || Anti-Cheat
var laptime : int %<- Lap Times
laptime := Time.Elapsed
font1 := Font.New ("Arial :20")
x := 230
y := 15
%% Graphics
colorback (255)
cls
procedure Track
%Start/Finish Line
Draw.Line (190, 30, 190, 0, 68)
%Checkpoint Line
Draw.Line (190, maxy - 25, 190, maxy - 68, 72)
%Borders
Draw.Line (1, 1, maxx, 1, 79)
Draw.Line (maxx - 1, maxy - 21, maxx - 1, 0, 79)
Draw.Line (1, maxy - 21, 1, 21, 79)
Draw.Line (1, maxy - 25, maxx - 1, maxy - 25, 79)
%Track Outline
Draw.Line (75, 30, 500, 30, 0)
Draw.Line (500, 30, 500, 180, 0)
Draw.Line (500, 180, 350, 180, 0)
Draw.Line (350, 180, 350, 280, 0)
Draw.Line (425, 230, maxx, 230, 0)
Draw.Line (350, 280, 500, 280, 0)
Draw.Line (500, 280, 500, 330, 0)
Draw.Line (500, 330, 75, 330, 0)
Draw.Line (75, 330, 75, 30, 0)
Draw.Fill (100, 80, 8, 0)
end Track
%% Procedures
%Draw Piece
procedure Char
Draw.FillBox (x, y, x + 10, y + 5, 10) %<- Draws The Char, Change If You Want To
Draw.FillBox (x, y + 5, x, y, 255) %<- Black Edges To Cancel Out Drawing Over All Over
Draw.FillBox (x + 10, y, x, y, 255)
Draw.FillBox (x, y, x + 10, y, 255)
Draw.FillBox (x + 10, y, x + 10, y + 5, 255)
Draw.FillBox (x + 10, y, x, y, 255)
Draw.FillBox (x, y + 5, x + 10, y + 5, 255)
end Char
%Get Keys (To Move The Piece / Char)
procedure Keys
Input.KeyDown (keys)
if keys (KEY_RIGHT_ARROW)
then
delay (2)
x += 1
elsif keys (KEY_LEFT_ARROW)
then
delay (2)
x -= 1
elsif keys (KEY_UP_ARROW)
then
delay (2)
y += 1
elsif keys (KEY_DOWN_ARROW)
then
delay (2)
y -= 1
end if
end Keys
procedure ColDet
%Collision Detection
if whatdotcolour (x + 5, y + 5) = 8
or whatdotcolour (x + 10, y) = 8
or whatdotcolour (x - 1, y) = 8
or whatdotcolour (x + 5, y + 5) = 0
or whatdotcolour (x + 10, y) = 0
or whatdotcolour (x - 1, y) = 0
then
Font.Draw ("YOU CRASHED!", maxx div 5, maxy div 2, font1, 15) %<-Tells User They Crash
delay (1000)
Font.Draw ("YOU CRASHED!", maxx div 5, maxy div 2, font1, 8) %<-Write Over In Grey
Font.Draw ("GAME OVER!", maxx div 5, maxy div 2, font1, 255) %<-Show Its Game Over
delay (1000)
quit
end if
end ColDet
%Lap Counter
procedure LapCounter
if whatdotcolour (x + 12, y) = 68 %<-Tells Laps
and check = 1
then
laps += 1
cls
Text.Locate (1, 1)
color (10)
put "Lap ", laps, " Done In ", laptime, " Seconds!"
laptime := 0
check := 0
Track
end if
%If Laps Are 0 Then...
if laps = 5
then
Font.Draw ("You Won!", maxx div 5, maxy div 2, font1, 255)
Input.Pause
quit
end if
end LapCounter
%Checks If You Have Gone Over Checkpoint
procedure Checkpoint
if whatdotcolour (x, y) = 72
then
check := 1
end if
end Checkpoint
%%% Game Loop
Track
loop
Char
Keys
ColDet
LapCounter
Checkpoint
end loop
|
Enjoy |
|
|
|
|
|
zomg
|
Posted: Tue Nov 30, 2004 12:10 pm Post subject: (No subject) |
|
|
fun stuff
my best time is 4 seconds |
|
|
|
|
|
MiX-MaztA-M8riX
|
Posted: Tue Nov 30, 2004 12:15 pm Post subject: (No subject) |
|
|
Thx a lot, my first actual game, apart from the crap-tastic D&D Variation I tried earlier |
|
|
|
|
|
Shyfire
|
Posted: Tue Nov 30, 2004 2:27 pm Post subject: (No subject) |
|
|
sweet!!!!!!!!!!!!!!
i love this game
any one else with good games |
|
|
|
|
|
omar
|
Posted: Wed Dec 01, 2004 8:41 am Post subject: (No subject) |
|
|
Update--- kinda 2 hard but that's cool |
|
|
|
|
|
Sponsor Sponsor
|
|
|
cool dude
|
Posted: Wed Dec 01, 2004 8:54 am Post subject: (No subject) |
|
|
the time is screwed up. it always says 5 seconds |
|
|
|
|
|
MattyGG
|
Posted: Wed Dec 01, 2004 11:55 am Post subject: (No subject) |
|
|
Pretty sweet...but i think the time is a little messed up...it says it was 18 seconds when i know for a fact that it was much less than that...but other than that...its an amazing game...takes awhile to master...good job |
|
|
|
|
|
zomg
|
Posted: Wed Dec 01, 2004 12:03 pm Post subject: (No subject) |
|
|
dude i think i kno why the timing is off... u put time.elapsed. well each processor is different
it doesnt have to do with actual time it goes by processor time
and after a while it gets cached in so it stays at the same time
just thought i'd tell
turing is just stupid that way |
|
|
|
|
|
m&m
|
Posted: Wed Dec 01, 2004 12:10 pm Post subject: (No subject) |
|
|
i love this... so fun |
|
|
|
|
|
the_short1
|
Posted: Wed Dec 01, 2004 4:48 pm Post subject: (No subject) |
|
|
nice.... couple suggestions..
make the box look like this | when going up or down....
make number of laps 3 .. .as 5 is kidna boring and takes too long...
post as .t when ur program is bigger then 25 lines of code.. (attach the source)
thigns i like:
how the box is shinking / getting larger.. to make it look like its vibrating or w.e...... and the good speed of movement and colision detection!
-shorty |
|
|
|
|
|
BPhelmet
|
Posted: Sun Dec 19, 2004 10:54 pm Post subject: (No subject) |
|
|
how come the other loops are all done in 0 seconds? |
|
|
|
|
|
|
|