Posted: Thu Feb 24, 2005 9:21 am Post subject: My Copter Game
This is my version of the "helicopter game", you just hold the mose down (and let go) to dodge the missles. This game has more pictures, but i dont have any cd-rw's or floppy's so i cant bring the game home and zip it, so thats why it's like this. You have to use the top10reset once to make default scores/names.
[ Top10reset ]
code:
var streamout : int
var highnumb : array 1 .. 10 of int
var highname : array 1 .. 10 of string
open : streamout, "top10", put
for i : 1 .. 10
highnumb (i) := 0
highname (i) := "Newb001"
put : streamout, highname (i)
put : streamout, highnumb (i)
end for
close : streamout
And Here's the game
code:
import GUI
setscreen ("graphics:300;200,position:center;center,nobuttonbar,title: Created By: Jamonathin")
var back : array 1 .. 10 of int
back (1) := Pic.FileNew ("clouds.bmp")
back (2) := Pic.FileNew ("clouds.bmp")
back (3) := Pic.FileNew ("clouds.bmp")
back (4) := Pic.FileNew ("clouds.bmp")
var heliback : int := Pic.FileNew ("heliback.bmp")
var cldx1, cldx2, name : int := 0
var maxpeople : int := 10
var newname : string
var names : array 1 .. maxpeople of string
var scores : array 1 .. maxpeople of int
var fileName : string := "top10.txt"
var fileIn : int
var trailx, traily : array 1 .. 50 of int
var misx, misy, misalive : array 1 .. 100 of int
var x, y, z, mousex, mousey, random, count, finish, dodged, ccount, backnum, backselect, scalepic, charselect, start, miscount, player, misselect, missiles : int := 1
backnum := 1
x := 50
y := 125
cldx2 := 500
finish := 0
dodged := 0
for i : 1 .. 100
misx (i) := 500
misy (i) := 250
misalive (i) := 1
end for
proc sort
for i : 1 .. maxpeople
for q : 2 .. maxpeople
if scores (q - 1) < scores (q) then
var temp : int := scores (q - 1)
scores (q - 1) := scores (q)
scores (q) := temp
var temp2 : string := names (q - 1)
names (q - 1) := names (q)
names (q) := temp2
end if
end for
end for
end sort
proc refresh
cls
Pic.Draw (back (backnum), cldx1, 0, picCopy)
Pic.Draw (back (backnum), cldx2, 0, picCopy)
Pic.Draw (copter (ccount), x, y, picMerge)
for i : 1 .. count
if misalive (i) = 1 then
Pic.Draw (missile (miscount), misx (i), misy (i), picMerge)
end if
end for
View.Update
end refresh
process malive
for i : 1 .. count
if misx (i) + 80 <= 0 then
misalive (i) := 0
misx (i) := 1000
count += 1
dodged += 1
randint (random, 20, 260)
misy (count) := random
end if
end for
end malive
process hit
for i : 1 .. 100
if misx (i) < x + 77 and misy (i) > y and misy (i) < y + 17 and misx (i) + 80 > x then
finish := 1
end if
end for
end hit
proc game
setscreen ("graphics:500;300,position:center;center,nobuttonbar,offscreenonly,title: Created By: Jamonathin")
colorback (black)
cls
loop
color (white)
mousewhere (mousex, mousey, z)
if x > 95 then
y -= 4
end if
if z = 1 then
y += 8
end if
if x < 100 then
x += 2
else
cldx1 -= 2
cldx2 -= 2
misx (count) -= 8 + (dodged div 5)
end if
if cldx1 + 500 <= 0 then
cldx1 := 500
elsif cldx2 + 500 <= 0 then
cldx2 := 500
end if
if y + 30 >= maxy or y <= 0 then
finish := 1
end if
fork malive
fork hit
miscount := missiles
ccount := player
refresh
delay (5)
miscount := missiles + 1
ccount := player + 1
refresh
delay (5)
exit when finish = 1
end loop
end game
loop
exit when GUI.ProcessEvent or finish = 1
end loop
delay (500)
cls
% Getting the previous Top 10 Scores
var streamin : int
var highnumb : array 1 .. 10 of int
var highname : array 1 .. 10 of string
open : streamin, "top10", get
for i : 1 .. 10
get : streamin, highname (i)
get : streamin, highnumb (i)
end for
close : streamin
% Checking if new score belongs on Top 10
color (white)
if dodged > highnumb (10) then
setscreen ("graphics:300;100,position:center;center,nobuttonbar,nooffscreenonly,title:Jamonathin")
colorback (black)
color (yellow)
cls
put " -= High Score =-"
put ""
put " Enter Your Name [10 or less chars]"
locate (5, 14)
color (white)
get newname
loop
if length (newname) > 10 then
drawfillbox (0, 0, maxx, 50, black)
locate (5, 14)
get newname
end if
exit when length (newname) < 11
end loop
end if
var done : int := 0
for decreasing i : 10 .. 2
if dodged > highnumb (i) and dodged <= highnumb (i - 1) and done = 0 then
for decreasing q : 9 .. i
highnumb (q + 1) := highnumb (q)
highname (q + 1) := highname (q)
end for
highnumb (i) := dodged
highname (i) := newname
done := 1
elsif dodged > highnumb (1) then
for decreasing q : 10 .. 2
highnumb (q) := highnumb (q - 1)
highname (q) := highname (q - 1)
end for
highnumb (1) := dodged
highname (1) := newname
done := 1
end if
end for
var streamout : int
open : streamout, "top10", put
for i : 1 .. 10
put : streamout, highname (i)
put : streamout, highnumb (i)
end for
close : streamout
setscreen ("graphics:300;350,position:center;center,nobuttonbar,nooffscreenonly,title: Created By: Jamonathin")
colorback (black)
color (yellow)
cls
put " -= Top 10 Scores =-"
color (white)
for i : 1 .. 10
locate (i + 2, 2)
put highname (i)
locate (i + 2, 12)
put " - ", highnumb (i)
end for
put skip
if dodged >= highnumb (10) then
color (10)
else
color (12)
end if
locate (15, 2)
put " You Dodged ", dodged, " Missiles."
put skip
put " Speed = ", 8 + (dodged div 5)
Hope you guys like it
Sponsor Sponsor
Drakain Zeil
Posted: Thu Feb 24, 2005 2:08 pm Post subject: (No subject)
You really should have made those BMPs to JPGs for bandwidth's sake, and your attachment size limit.
You can do it with most graphical programs, like the gimp (www.gimp.org)
jamonathin
Posted: Thu Feb 24, 2005 2:21 pm Post subject: (No subject)
Sounds hawt, ill do that next time
Tony
Posted: Thu Feb 24, 2005 2:41 pm Post subject: (No subject)
put it all together into a single zip file. I'm not downloading 6 images and making two turing files.
Carino
Posted: Thu Feb 24, 2005 2:46 pm Post subject: (No subject)
I agree. Include both turing files and all the pics in a zip, its wayyy to much to download.
Token
Posted: Thu Feb 24, 2005 4:09 pm Post subject: (No subject)
well i had nothing to do so i did it all and it looks pretty good, the only thing is that when you release the button it should still go up for a little bit, so that it would still have an upward motion like this
http://www.ebaumsworld.com/helicopter.shtml
other than that it seems great!
[Gandalf]
Posted: Fri Feb 25, 2005 7:00 pm Post subject: (No subject)
please make it a .zip file - I want to try it, but nobody wants to put all that together
Flikerator
Posted: Fri Feb 25, 2005 11:50 pm Post subject: (No subject)
I agree. I want to try it out but im just so lazy i don't want to dowload all those.
Sponsor Sponsor
person
Posted: Sat Feb 26, 2005 1:24 pm Post subject: (No subject)
zipping it is the way to go, but if ur lazy like we r, can u give us a snap shot
zipping it would be great, i really want to play it
jamonathin
Posted: Sun Feb 27, 2005 5:52 pm Post subject: (No subject)
Sorry it took me so long. . i've had a busy past few days, but here it is.
person
Posted: Sun Feb 27, 2005 6:17 pm Post subject: (No subject)
doesnt work for some reason
jamonathin
Posted: Sun Feb 27, 2005 6:47 pm Post subject: (No subject)
You proabibly didn't catch it, and i should have re-said it, but in my original post it says to run the top10reset frist, so you can have a default scores/names in the top10, and it's also there to reset the top10 (hence the name), so that's why it didn't work right.
ssr
Posted: Sun Feb 27, 2005 7:13 pm Post subject: (No subject)
ok thats a nice game
but I thought u could make the copter less complicated (the graphics) it would actually look more smoothly....
and ya also
make an option for the users to change the speed I donno, its stil too slow and easy
oooo
u knwo waht would be great
to let teh user make their own levels....
nice game
jamonathin
Posted: Sun Feb 27, 2005 7:27 pm Post subject: (No subject)
well, "technically", the user can make thier own backgrounds, just find a pic and replace one of the
code:
back (2) := Pic.FileNew ("clouds.bmp")
and i'm not sure how far you made it in the game, but the speed changes for every 5 missles you dodge
code:
misx (count) -= 8 + (dodged div 5)
but the graphics on the helicopter can use a lil editing, i'll look into that next time ssr
but thx for the tips
Bacchus
Posted: Sun Feb 27, 2005 7:54 pm Post subject: (No subject)
psst.. processes r evil also i agree with the other ppl that it should move upwards after ur done clicking, use velocities and gravity to do that. in example: (u kno i figured out i do most of my programing from ideas i get from ppl here on compsci lol)
code:
setscreen ("title:Copter Thingy by Bacchus,offscreenonly,nobuttonbar,graphics:300;300,position:centre;middle")
var mx, my, mb : int
var x, y, vx, vy : real
const gravity := 0.8
var chars : array char of boolean
var done : boolean := false
var boom : flexible array 1 .. 0 of
record
x, y, vx, vy : real
end record
x := 100
y := 150
vx := 0
vy := 0
colorback (2)
cls
color (4)
put "Click the Mouse to increase your upwards speed"
put "Press 'w' to add another obstical, press 'q' to take one away"
loop
cls
Mouse.Where (mx, my, mb)
if mb = 1 then
vy += 1.5
end if
if y < 50| y + 5 > maxy - 50 then
done := true
end if
Input.KeyDown (chars)
if chars ('w') then
new boom, upper (boom) + 1
boom (upper (boom)).x := maxx
boom (upper (boom)).y := Rand.Int (0, maxy)
boom (upper (boom)).vx := Rand.Int (5, 20)
boom (upper (boom)).vy := Rand.Real
if boom (upper (boom)).vy >= 0.7 then
boom (upper (boom)).vy := 0
end if
elsif chars ('q') then
if upper (boom) > 0 then
new boom, upper (boom) - 1
end if
end if