Posted: Thu Dec 15, 2011 8:07 pm Post subject: Helicopter Game Help
I'm sure everyone here has played the infamous Helicopter game where you simply click the screen to increase elevation and let go to decrease.
Okay, so I am trying to make a helicopter game, I have the intro done but i need a lot of help making the environment that is passes through and so on. I also am looking to making a separate page for controls which you can view before selecting to play the game.
Keeping in mind i will want it to be as realistic as possible like I want the distance to be counting in the corner of the screen and so on.
I need to make it so that when the colours of the helicopter contact the colours of the environment, then it ends the game and says replay, I am not new to Turing so I will for the better part know what you guys are trying to say however don't make it to complex.
This is what I have so far.
Turing:
var icolor :int var icolor2 :int var iXposition :int var iYposition :int var xdirection :int var ydirection :int var font :int var font1 :int var font2 :int
font :=Font.New("serif:50")
font1 :=Font.New("serif:20")
font2 :=Font.New("serif:20")
Posted: Thu Dec 15, 2011 8:48 pm Post subject: RE:Helicopter Game Help
I can't even read your post, my eyes hurt. Don't post in all bold!!
I'm not sure I can infer your problem, considering I could barley comprehend your giant wall of dark text. If you did state your problem, I missed it.
Where do you need help? Specifically? and what have YOU tried to fix it?
EDIT: I think in a lucky glance at that cannon up there, I have found your problem (?).
Quote:
I need to make it so that when the colours of the helicopter contact the colours of the environment, then it ends the game
code:
loop
if helicopter.color = helicopter.contractColor then
endGame := true
end if
exit when endGame = true
end loop
Conrad13
Posted: Thu Dec 15, 2011 9:42 pm Post subject: Re: Helicopter Game Help
Well, I have more then a simple problem, and sorry for the text as this is my first post I didnt know what to do. But anyways basically these are my problems:
- Creating a Menu where you click on the Controls or the Play and it takes you to either controls or play.( I created that intro part seen above however i do not know how to get it so that when you click it brings you to the controls or enters the game.
- Then I need to basically create the game (Helicopter controls (arrow keys or mouse click), environment to which it must dodge something i do not know what yet(hopefully more then shapes).
- Then the part where it measures (in the corner of the screen) the distance and after you crash it pops up and says the distance that you traveled.
- Then basically a key input that brings you back to the main Home screen
Aange10
Posted: Thu Dec 15, 2011 10:29 pm Post subject: RE:Helicopter Game Help
In the Turing Walkthrough, you can find answers to most of your questions. I expect you to go through there and read things like Keyboard Input, Mouse detection, etc. The tutorials are there for a reason.
I will help you with a basic algorithm to achieve your aspirations.
- When you read a tutorial on how to track clicking, you'll already be half done. Now just see if the user clicked on the play, and if it did then continue on. (etc)
- Collision detections is also in the walkthrough. The biggest hint I can give you is that there is no 'camera' in Turing. The way you have a camera is your draw things closer/farther to yourself.
- if I start a 0 and my x is now 500 then I've travled 500. SHould be simple.
-You know how to get input, so figure out how to loop to the main menu
Conrad13
Posted: Thu Dec 15, 2011 10:48 pm Post subject: Re: Helicopter Game Help
Thanks for the reply, it did help however still not 100% sure i am capable of like looping back to the main menu, am i supposed to name the loop so it knows what to loop back to or am i supposed to use if, then, input statements?
Also how will i create the flight course? do i need to make like 1000 shapes at which the helicopter must fly through that continuously loop through each other, or do i set it to the the y2 value of a drawfillbox to a random variable?
Aange10
Posted: Fri Dec 16, 2011 1:15 am Post subject: RE:Helicopter Game Help
Easiest thing to do would be to learn about Records and Arrays. From there you can just randomly place obsticles on your path.
There are tons of ways to do one thing, but I'll show you two of the most common.
Here's the easiest one, but it can make a mess sometimes.
Turing:
loop % Main menu loop % Game exitwhen they click menu
endloop endloop
However, a better way to go about this, if you know procedures, could be something like this:
Turing:
var gotoMainMenu :boolean:=false
proc MainMenu
var choseOption :boolean:=false % Draw the main menu, options, etc. loop % Loop here untill they choose an option exitwhen choseOption =true endloop
gotoMainMenu :=false end MainMenu
loop % Run the Game, somewhere in here you will check for the 'exit' key to be pressed % When pressed you can toggle the main menu, and reset variables [if you want] if gotoMainMenu =truethen
MainMenu
endif endloop
Study up on records and arrays for your second question. You will need to have a firm grasp on for loops as well.
A general gist of what you'll be doing:
Turing:
% Make a Record type OData : record
x, y, x2, y2, Color :int endrecord
% Make an array of the record var obsticles :array0.. 30of OData
% Initialize the array
for i :0.. upper(obsticles) % There'll be a bit of math here. Try and see whats happening. % This way will keep our boxes from just being in a straight line, or % on top of each other.
obsticles (i).x :=150 + (i *200)% (the 200 is the spacing)
obsticles (i).y :=100 + (25* Rand.Int (1, 15))% This will vary where the y cords of the block are
obsticles (i).x2 := obsticles (i).x + 20% 20 is the width
obsticles (i).y2 := obsticles (i).y + 20% 20 is the height
obsticles (i).Color := Rand.Int (7, 14) endfor
% For a visual on how this works;
loop cls % Move all the blocks over by 20 for i :0.. upper(obsticles)
obsticles (i).x += -20
obsticles (i).x2 += -20 endfor % Draw them all for i :0.. upper(obsticles) drawfillbox(obsticles (i).x, obsticles (i).y, obsticles (i).x2, obsticles (i).y2, obsticles (i).Color) endfor % My little exit statement to stop when all the obsticles have passed if obsticles (upper(obsticles)).x < 0then exit endif Time.DelaySinceLast(50) endloop
There are many ways to make this better, and to customize it and optimize it. Hopefully that teaches you the concept a bit, but still read the tutorials.
Nothings set in stone
Conrad13
Posted: Fri Dec 16, 2011 1:25 pm Post subject: Re: Helicopter Game Help
Ok so i managed to update the menu a few.. i only had a few minutes at school but now atleast when the play or controls is selected, the function happens!
This is what i have so far:
var icolor : int
var icolor2 : int
var iXposition : int
var iYposition : int
var xdirection : int
var ydirection : int
var font : int
var font1 : int
var font2 : int
var xmouse, ymouse, button : int
font := Font.New ("serif:50")
font1 := Font.New ("serif:25")
font2 := Font.New ("serif:25")
if xmouse>290 and xmouse<370 and ymouse>230 and ymouse<280 and button=1 then
Draw.Cls
View.Update
exit
end if
if xmouse>270 and xmouse<390 and ymouse>140 and ymouse<190 and button=1 then
Draw.Cls
View.Update
exit
end if
%drawfillbox (290,230,370,280,41)
%drawfillbox (270,140,390,190,41)
icolor := icolor + 1
if icolor = 62 then
icolor := 1
end if
icolor2 := icolor2 + 1
if icolor2 = 31 then
icolor2 := 21
end if
iXposition := iXposition + xdirection
iYposition := iYposition + ydirection
if iXposition > 445 or iXposition < 0 then
xdirection := -xdirection
end if
if iYposition > 305 or iYposition < 80 then
ydirection := -ydirection
end if
delay (10)
View.Update
end loop
Aange10
Posted: Fri Dec 16, 2011 3:36 pm Post subject: RE:Helicopter Game Help
contrats! And I suggest wrapping your code in
[ syntax = "turing"]
and
[ /syntax ]
Sponsor Sponsor
Conrad13
Posted: Fri Dec 16, 2011 10:40 pm Post subject: Re: Helicopter Game Help
Thanks Man Helped Me out a lot!! The biggest problem was knowing where to put the separate screens and if i have to loop them separately but I think i have it figured out thanks again! If i need further assistance keep me posted please thank you!
Conrad13
Posted: Mon Dec 19, 2011 4:48 pm Post subject: Re: Helicopter Game Help
Ok, so this is my code so far i know i do not have the game going yet however I feel the need to update my post
[ syntax = "turing"]
var icolor : int
var icolor2 : int
var iXposition : int
var iYposition : int
var xdirection : int
var ydirection : int
var font : int
var font1 : int
var font2 : int
var font3 : int
var xmouse, ymouse, button : int
var ch : string (1)
% Play
if xmouse>290 and xmouse<370 and ymouse>170 and ymouse<220 and button=1 then
Draw.Cls
Draw.Text ("CONGRATS, You Lose!", 175, 200, font1, black)
View.Update
exit
end if
% Controls
if xmouse>270 and xmouse<390 and ymouse>100 and ymouse<150 and button=1 then
Draw.Cls
View.Update
% Cloud 2
drawfilloval (400, 150, 130, 80, white)
drawfilloval (380, 80, 80, 40, white)
drawfilloval (410, 220, 80, 40, white)
drawfilloval (520, 110, 70, 50, white)
drawfilloval (520, 190, 80, 50, white)
drawfilloval (300, 180, 60, 50, white)
drawfilloval (300, 120, 40, 30, white)
Draw.Text ("Controls", 265, 335, font1, black)
Draw.Text ("Press B to go Back", 15, 360, font2, black)
Draw.Text ("Welcome to Super-Heli, the classic game that never gets boring!", 70, 285, font2, black)
Draw.Text ("The controls of this game are basic, to raise your helicopter,", 80, 255, font2, black)
Draw.Text ("simply click your mouse to ascend your helicopter vertically,", 77, 225, font2, black)
Draw.Text ("to descend your helicopter, let go of the mouse button.", 100, 195, font2, black)
Draw.Text ("Good luck and have fun!", 230, 165, font2, black)
Draw.Text ("Trademark to the IGC (International Gaming Corporation) Do not copy this game.", 115, 15, font3, black)
View.Update
getch (ch)
if ch = "b" then
exit
else
end if
end loop
else
end if
%drawfillbox (290,170,370,220,41)
%drawfillbox (270,100,390,150,41)
icolor := icolor + 1
if icolor = 62 then
icolor := 1
end if
icolor2 := icolor2 + 1
if icolor2 = 31 then
icolor2 := 21
end if
iXposition := iXposition + xdirection
iYposition := iYposition + ydirection
if iXposition > 455 or iXposition < 0 then
xdirection := -xdirection
end if
if iYposition > 215 or iYposition < 0 then
ydirection := -ydirection
end if
delay (0)
View.Update
end loop
[ /syntax ]
I could use some help as to where to start my game .
Like i do no know where to start, i feel if i get a start i can move from there any ideas?
Thanks to all contributor(s) <<<----- so far aka Aange10
Conrad13
Posted: Tue Dec 20, 2011 7:05 pm Post subject: Re: Helicopter Game Help
BUMP Help me please?
Can someone show me a detailed turing code to help me start the environment in which the helicopter will be passing through, like the original game, i need random obstacle relays and pleeasseee help me i do not know where to start.
Aange10
Posted: Tue Dec 20, 2011 7:30 pm Post subject: RE:Helicopter Game Help
Sorry for not being specific, when you use the BBC codes ([ /syntax] and what not) you don't add the spaces.
Conrad13 wrote:
Can someone show me a detailed turing code to help me start the environment in which the helicopter will be passing through,i need random obstacle relays
I beleive the code ^ Just showed you how to make this 'environment' with random obstacles.
Conrad13
Posted: Tue Dec 20, 2011 9:00 pm Post subject: Re: Helicopter Game Help
My, bad I did not see that post :S so sorry, and I have another question:
- In the real game the bottom of the screen has a floor and the top, a roof so basically you are flying through a cave and you are dodging rectangles that protrude from the roof or the floor would it be possible to do something like that instead of shapes flying toward you?
Aange10
Posted: Tue Dec 20, 2011 9:57 pm Post subject: Re: Helicopter Game Help
Conrad13 @ 20/12/2011, 8:00 pm wrote:
would it be possible to do something like that instead of shapes flying toward you?
Aange10 wrote:
Nothings set in stone
Aange10
Posted: Tue Dec 20, 2011 9:58 pm Post subject: RE:Helicopter Game Help
Specifically
Turing:
cls % Move all the blocks over by 20 for i :0.. upper(obsticles)
obsticles (i).x += -20
obsticles (i).x2 += -20