Posted: Tue Nov 25, 2008 9:33 am Post subject: Gr. 10 Game
Hey, before I talk abou the game I will just let you know I recently joined. I have been using this site for 2-3 months but haven't registered an account until now. I have worked on a few games, and I will post them here for comments etc. First off a game I call "Circular Danger" (Yes I know gay name but I'm not good with names lol.) I don't know how to upload the game so you can dowload it so I will just post the code, even though it is over 1300 lines but could be reduced to about 400 If I was smarter.
Turing:
View.Set("position:center;center,offscreenonly, nocursor, nobuttonbar,title: Avoid the Circles!!") % variables var circle_1_x, circle_1_y, circle_1_radius :int var circle_2_x, circle_2_y, circle_2_radius :int var circle3x, circle3y, circle3radius :int var circle4x, circle4y, circle4radius :int var circle5x, circle5y, circle5radius :int var circle6x, circle6y, circle6radius :int var circle7x, circle7y, circle7radius :int var circle8y, circle8x, circle8radius :int var circle9y, circle9x, circle9radius :int var x :int% your circle var y :int% your circle var circle_radius :int% your circle var chars :arraycharofboolean var xdir :int:=2% all stuff for boundaries var ydir :int:=2% " " var xdir2 :int:=3 var ydir2 :int:=3 var xdir3 :int:=5 var ydir3 :int:=5 var xdir4 :int:=4 var ydir4 :int:=4 var xdir5 :int:=10 var ydir5 :int:=10 var xdir6 :int:=2 var xdir7 :int:=2 var ydir8 :int:=2 var ydir9 :int:=2 var distance_between_centres :real% stuff for collision var distance_betweeen_centres :real var distance_betweeeen_centres :real var distance_betweeeeen_centres :real var distance_betweeeeeen_centres :real var distance_between_centres1 :real var distance_between_centres2 :real var distance_between_centres3 :real var distance_between_centres4 :real var counter :int% To end levels at certain times var counter2 :int var counter3 :int var counter4 :int var counter5 :int var font1 :int var gameover :int var youwin :int var key :string(1) var level :int var choice :string var deadoralive :string:="alive" var colourcount :int:=32 %%%%%%%%%%%%%%%%%%%%%%%Mouse%%%%%%%%%%%%%%%% var mx, my, mb :int:=0
/*****TITLE PAGE*******/ loop cls
drawfill (maxx, maxy, 10, 14) Font.Draw("Welcome to Circular Danger",9, 300, font1, 255) locatexy(1, 100) colorback(103) put" Press any key to continue":1 getch(key) View.Update cls %%%%%%%%%%Choice Screen%%%%%%%%%%%%%%% View.Update
drawfill (maxx, maxy, 42, 42) colorback(94) locatexy(1, 300) put"1. How to Play...?" locatexy(1, 250) put"2. Start the Game!!! (Using keys)" locatexy(1,200) put"3. Start the Game!!! (Using mouse)" locatexy(1, 150) put"Please choose an option or enter a cheat." View.Update get choice
cls if choice ="1"then %%%%%%%%%%%%%How to Play screen%%%%%%%%%%
drawfill (maxx, maxy, 88, 88) colourback(118) locatexy(1, 350) put" OBJECTIVE" colourback(68) locatexy(1, 290) put"The objective of circular danger is quite simple, AVOID the CIRCLES." colourback(118) locatexy(1, 230) put" CONTROLS" colourback(68) locatexy(1, 170) put"You control the circle that flashes different colours using the arrow keys." put"Up arrow moves you up, Down arrow moves you down, Left arrow moves you left and the Right arrow moves you right." colourback(61) locatexy(1, 80) put" Press any key to start the game" View.Update getch(key) exit elsif choice ="2"then exit elsif choice ="smallcircle"then
circle_radius :=5 locatexy(1, 400) put"Cheat smallcircle activated." View.Update getch(key) exit elsif choice ="bigdanger"then
circle_1_radius :=65
circle_2_radius :=80
circle3radius :=30
circle4radius :=46
circle5radius :=7
circle_radius :=19 locatexy(1, 400) put"Cheat bigdanger activated." put"Good luck, you will need it!" View.Update getch(key) exit elsif choice ="speedy"then locatexy(1, 400) put"Cheat speedy activated." put"Fasten your seatbelt." View.Update getch(key) exit elsif choice ="3"then exit endif endloop
%%%%%%%%%%%%%Level 1 loop%%%%%%%%%%%%%
loop
counter := counter + 1 put counter
if colourcount > 55then
colourcount :=32 endif
colourcount := colourcount + 1 exitwhen counter > 700 %for i : 1 .. 45 %draw our circles cls
drawfill (maxx, maxy, 101, 101) Font.Draw("Level 1",285, 380, level, 255) drawfilloval(circle_1_x, circle_1_y, circle_1_radius, circle_1_radius, 36)%big one you're avoiding drawfilloval(circle_2_x, circle_2_y, circle_2_radius, circle_2_radius, 23)%big one you're avoiding delay(8) View.Update % Move your circle Input.KeyDown(chars) if choice ="1"or choice ="2"then drawfilloval(x, y, circle_radius, circle_radius, colourcount)%one that you move if choice ="smallcircle"then
if chars (KEY_UP_ARROW)and y < 385then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 625then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 14then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 12then
y := y - 4 endif
elsif choice ="speedy"then
if chars (KEY_UP_ARROW)and y < 375then
y := y + 8 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 8 endif if chars (KEY_LEFT_ARROW)and x > 27then
x := x - 8 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 8 endif
else
if chars (KEY_UP_ARROW)and y < 375then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 23then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 4
drawfilloval(mx, my, circle_radius, circle_radius, colourcount)%one that you move View.Update delay(8) cls endif %Move the other circles if choice ="bigdanger"then
loop if deadoralive ="alive"then
counter2 := counter2 + 1 put counter2
exitwhen counter2 > 600 if colourcount > 55then
colourcount :=32 endif
colourcount := colourcount + 1 cls
drawfill (maxx, maxy, 84, 84) Font.Draw("Level 2",285, 380, level, 255) drawfilloval(circle_1_x, circle_1_y, circle_1_radius, circle_1_radius, 36)%big one you're avoiding drawfilloval(circle_2_x, circle_2_y, circle_2_radius, circle_2_radius, 23)%very big one you're avoiding drawfilloval(circle3x, circle3y, circle3radius, circle3radius, 45)%small one you're avoiding delay(10)
% Move your circle Input.KeyDown(chars) if choice ="1"or choice ="2"then drawfilloval(x, y, circle_radius, circle_radius, colourcount)%one that you move if choice ="smallcircle"then
if chars (KEY_UP_ARROW)and y < 385then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 625then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 14then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 12then
y := y - 4 endif
elsif choice ="speedy"then
if chars (KEY_UP_ARROW)and y < 375then
y := y + 8 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 8 endif if chars (KEY_LEFT_ARROW)and x > 27then
x := x - 8 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 8 endif
else
if chars (KEY_UP_ARROW)and y < 375then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 27then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 4 endif endif
loop if deadoralive ="alive"then if colourcount > 55then
colourcount :=32 endif
colourcount := colourcount + 1 cls
drawfill (maxx, maxy, 3, 3) Font.Draw("Level 3",285, 380, level, 255) drawfilloval(circle_1_x, circle_1_y, circle_1_radius, circle_1_radius, 36)%big one you're avoiding drawfilloval(circle_2_x, circle_2_y, circle_2_radius, circle_2_radius, 23)%very big one you're avoiding drawfilloval(circle3x, circle3y, circle3radius, circle3radius, 45)%small one you're avoiding drawfilloval(circle4x, circle4y, circle4radius, circle4radius, 76)%medium one you're avoiding delay(10)
% Move your circle Input.KeyDown(chars) if choice ="1"or choice ="2"then drawfilloval(x, y, circle_radius, circle_radius, colourcount)%one that you move if choice ="smallcircle"then
if chars (KEY_UP_ARROW)and y < 385then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 625then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 14then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 12then
y := y - 4 endif
elsif choice ="speedy"then
if chars (KEY_UP_ARROW)and y < 375then
y := y + 8 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 8 endif if chars (KEY_LEFT_ARROW)and x > 27then
x := x - 8 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 8 endif
else
if chars (KEY_UP_ARROW)and y < 375then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 27then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 4 endif endif
% Move your circle Input.KeyDown(chars) if choice ="1"or choice ="2"then drawfilloval(x, y, circle_radius, circle_radius, colourcount)%one that you move if choice ="smallcircle"then
if chars (KEY_UP_ARROW)and y < 385then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 625then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 14then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 12then
y := y - 4 endif
elsif choice ="speedy"then
if chars (KEY_UP_ARROW)and y < 375then
y := y + 8 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 8 endif if chars (KEY_LEFT_ARROW)and x > 27then
x := x - 8 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 8 endif
else
if chars (KEY_UP_ARROW)and y < 375then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 27then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 4 endif endif
loop if colourcount > 55then
colourcount :=32 endif
colourcount := colourcount + 1 if deadoralive ="alive"then cls
drawfill (maxx, maxy, 12, 12) Font.Draw("Level 5",285, 380, level, 255) drawfilloval(circle_1_x, circle_1_y, circle_1_radius, circle_1_radius, 36)%big one you're avoiding drawfilloval(circle_2_x, circle_2_y, circle_2_radius, circle_2_radius, 23)%very big one you're avoiding drawfilloval(circle3x, circle3y, circle3radius, circle3radius, 45)%small one you're avoiding drawfilloval(circle4x, circle4y, circle4radius, circle4radius, 76)%medium one you're avoiding drawfilloval(circle5x, circle5y, circle5radius, circle5radius, 57)%very small and fast one you're avoiding delay(10)
% Move your circle Input.KeyDown(chars) if choice ="1"or choice ="2"then drawfilloval(x, y, circle_radius, circle_radius, colourcount)%one that you move if choice ="smallcircle"then
if chars (KEY_UP_ARROW)and y < 385then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 625then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 14then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 12then
y := y - 4 endif
elsif choice ="speedy"then
if chars (KEY_UP_ARROW)and y < 375then
y := y + 8 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 8 endif if chars (KEY_LEFT_ARROW)and x > 27then
x := x - 8 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 8 endif
else
if chars (KEY_UP_ARROW)and y < 375then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 27then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 4 endif endif
Posted: Tue Nov 25, 2008 10:05 am Post subject: Re: Gr. 10 Game
That was a fun and fantastic game!!! +1 Karma (I need at least 25 posts, to be able to give you karma... you will recieve it soon) Thanks for posting your game!
You could of reduce the amount of else if and stuff...
but besides that it was Great
Hard to imagine that you only had like 2-3 months experience like me...
I wouldn't be able to make a that game...
It must have taken you a long time to do.
Awesome Game!!!
Insectoid
Posted: Tue Nov 25, 2008 12:25 pm Post subject: RE:Gr. 10 Game
You should arrange it so that when using mouse control, the circles don't start on top of you (causing and instant game-over). Also, you should use procedures. It would shorten your code to less than 200 lines, easily.
Parker
Posted: Tue Nov 25, 2008 3:44 pm Post subject: Re: RE:Gr. 10 Game
insectoid @ Tue Nov 25, 2008 12:25 pm wrote:
You should arrange it so that when using mouse control, the circles don't start on top of you (causing and instant game-over). Also, you should use procedures. It would shorten your code to less than 200 lines, easily.
Yes, this happens in the keyboard control mode as well. It has been a problem I have been annoyed about since I first started making the game but unsure how to fix it other than pausing between levels, and resetting where everything starts. About the procedures I have wondered about as well and wanted to do/learn. I don't know how to use procedures yet, and my teacher won't teach me. This game I will also be using for my final just improving later in the semested and my teacher said I cannot use procedures for my final because no other students would be able to. (therefore giving me an advantage)
And Thank you Jack, glad you liked it. I have been working with turing for about 6 months, but I meant only using this site for 2-3 months to help me. It did take me a while cause I have had to do other stuff my class is doing as well. (I was making this game while my teacher was teaching the class how to use a "put" command )
A.J
Posted: Tue Nov 25, 2008 3:53 pm Post subject: Re: Gr. 10 Game
not bad game, in fact it was very good
Hints to improve game:
- try making the enemy circles collide
- add more levels
- look into "type"'s and "record"'s
- try changing the enemy's shape (like adding a tail of circles behind them)
I recently made a game in turing that uses records, types and weird enemies....it might help u
Posted: Tue Nov 25, 2008 4:03 pm Post subject: Re: Gr. 10 Game
A.J @ Tue Nov 25, 2008 3:53 pm wrote:
not bad game, in fact it was very good
Hints to improve game:
- try making the enemy circles collide
- add more levels
- look into "type"'s and "record"'s
- try changing the enemy's shape (like adding a tail of circles behind them)
I recently made a game in turing that uses records, types and weird enemies....it might help u
I like your game, I am thinking about looking into effects. Have never used types or records but I will look into it. As I said in my last post about my teacher not letting me use procedures for my game, it will probably be the same so I have decided I will try to make the game using procedures, records and types but will save it under another name. Making the circles collide would definately make it a nice new challenge but would add alot of math to it, I will try that next though
Insectoid
Posted: Tue Nov 25, 2008 4:04 pm Post subject: RE:Gr. 10 Game
Your teacher won't allow you to use procedures?!?!? What a <sexual word> <body part>! That it will give you an advantage is the most ridiculous thing I have ever heard, yes, it gives you an advantage, but it is also one of the most important concepts in programming. If you go ahead to learn things on your own, you should be allowed to take full advantage of that knowledge. (sorry, long rant). I just can't get across how shocked I am by this guy! When I was in gr. 10, my teacher praised me for learning these things. You, sir, do not deserve to be taught by whoever it is that is teaching you. Hell, said teacher doesn't deserve to teach at all! Anywho, I'll stop now because I don't want to get any warnings for saying these things about a teacher, but I trust you get the gist of what I'm saying. Please, learn procedures. Once you understand them, you will never go back. If I were you, I would use procedures anyway, because I don't care if it hurts my mark, as long as it helps my understanding. But I don't recommend you do that, unless you are the same kind of person as me (the kind of person that psychs out the principal while you receive your honor role thingummy).
~Insectoid (still shocked)
EDIT: Beat me by a minute!
Parker
Posted: Tue Nov 25, 2008 4:25 pm Post subject: RE:Gr. 10 Game
Well first of all, my teacher is a women
Next, I am looking into tutorials on procedures and will be trying them out cause from what I hear (mainly from you but some others) they are good to work with lol. And um, my marks they matter quite a bit to me I had the highest mark in grade 9 and currently have a 93 average. Call me a nerd but I am very physically active, I play hockey and soccer. (I am quite good at both, played in an international soccer tourney in the summer and a national hockey tournament last year)
Sponsor Sponsor
SNIPERDUDE
Posted: Tue Nov 25, 2008 4:40 pm Post subject: RE:Gr. 10 Game
procedures are a HUGE part to organized code.
Jack140
Posted: Tue Nov 25, 2008 5:25 pm Post subject: Re: RE:Gr. 10 Game
SNIPERDUDE @ Tue Nov 25, 2008 4:40 pm wrote:
procedures are a HUGE part to organized code.
Agreed, its a huge life saver!!!
Trust me... instead of spending hours typing repetitve code over and over again...
You could of been done in less amounts of time, and by the way who cares if your teacher doesn't allow procedures!
(Its the whole part of the educational process, especially when learning a whole new language)...
A.J
Posted: Tue Nov 25, 2008 8:04 pm Post subject: Re: Gr. 10 Game
Parker wrote:
Making the circles collide would definately make it a nice new challenge but would add alot of math to it, I will try that next though
it is quite easy actually!
the most basic one (the one you could get away with using it now) is this.
code:
function Collide (var circle1x, circle1y, circle1r, circle2x, circle2y, circle2r : int) : boolean
result Math.Distance(circle1x, circle1y,circle2x, circle2y) < circle1.r + circle2.r
end Collide
all the above code means is if the distance between the centers of the 2 circles is less than the sum of the radii of the circles (i.e., if they are touching or gonr into each other) then return true. Otherwise, returns false!
This is not a very good way to check for collision (for a good way, check out the Perfect Circle Collision Tutorial) but it is nevertheless sufficient enough [syntax=""][/syntax][syntax=""][/syntax][syntax=""] [/syntax][syntax=""][/syntax]
gitoxa
Posted: Tue Nov 25, 2008 9:52 pm Post subject: RE:Gr. 10 Game
My teacher didn't allow me to use procedures in any of my grade 10 and start of grade 11 assignments. The reason for this was because he wanted us to learn how to use them properly.
Parker
Posted: Wed Nov 26, 2008 8:18 am Post subject: RE:Gr. 10 Game
Thanks A.J., I will try that out and if I can get it +1 karma (when I get 25 posts)
And gitoxa that may be part of the reason why my teacher doesn't want me using them.
EDIT: Just tried a few tutorials and I....am LOST I will keep trying and see if I can make some sense out of functions but for now nothing is going to be happening lol. On the bright side procedures don't seem too hard.
Parker
Posted: Tue Dec 02, 2008 8:35 am Post subject: Re: Gr. 10 Game
Tried to edit my first post but it wouldnt let me
I changed the code, using more procedures and arrays to shorten up a bit. I learned how to use these using tutorials on Compsci
Well, here is the new code, tell me if I used the procedures wrong, or if there is a better way, thanks.
Turing:
View.Set("position:center;center,offscreenonly, nocursor, nobuttonbar,title: Avoid the Circles!!") % variables var circlex :array0.. 8ofint var circley :array0.. 8ofint var circler :array0.. 8ofint var x :int% your circle var y :int% your circle var circle_radius :int% your circle var chars :arraycharofboolean var xdir :array0.. 6ofint var ydir :array0.. 6ofint var distance_between_centres :array0.. 8ofreal var counter :array0.. 4ofint var font1 :int var gameover :int var youwin :int var key :string(1) var level :int var choice :string var deadoralive :string:="alive" var colourcount :int:=32 %%%%%%%%%%%%%%%%%%%%%%%Mouse%%%%%%%%%%%%%%%% var mx, my, mb :int:=0
procedure movecircle
Input.KeyDown(chars) if choice ="1"or choice ="2"then drawfilloval(x, y, circle_radius, circle_radius, colourcount)%one that you move View.Update if choice ="smallcircle"then
if chars (KEY_UP_ARROW)and y < 385then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 625then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 14then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 12then
y := y - 4 endif
elsif choice ="speedy"then
if chars (KEY_UP_ARROW)and y < 375then
y := y + 8 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 8 endif if chars (KEY_LEFT_ARROW)and x > 27then
x := x - 8 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 8 endif
else
if chars (KEY_UP_ARROW)and y < 375then
y := y + 4 endif if chars (KEY_RIGHT_ARROW)and x < 613then
x := x + 4 endif if chars (KEY_LEFT_ARROW)and x > 23then
x := x - 4 endif if chars (KEY_DOWN_ARROW)and y > 25then
y := y - 4