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

Username:   Password: 
 RegisterRegister   
 Need help with helicopter game!(game similar to jetman)
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tanya kang




PostPosted: Wed Jun 04, 2008 4:22 pm   Post subject: Need help with helicopter game!(game similar to jetman)

HI everybody. I am doing a turing assignment at school. And I need a lot of help. I need to know how to make the clouds move and how to change the speed of the jet.
If any of you guys can help me or have comments, then that would be great!
P.S. Anybody know how to make the screen move like in a real game?
Sponsor
Sponsor
Sponsor
sponsor
tanya kang




PostPosted: Wed Jun 04, 2008 4:58 pm   Post subject: Re: Need help with helicopter game!(game similar to jetman)

o by the way.. the clouds are the thingies that the helicopter can't touch..as soon as the helicopter touches it it dies
I am also wondering how to make it so that when the cloud touches the helicopter, how do I know how to make it die.
PLEASE REPLY
I REALLY APRRECIATE IT!
jeffgreco13




PostPosted: Thu Jun 05, 2008 10:07 am   Post subject: Re: Need help with helicopter game!(game similar to jetman)

My suggestion to you is that in order to make a true animation seach these forums for the tutorial on View.Update. This allows for flicker-free animation when redrawing the canvas over and over and over to simulate the movement.

For the helicopter hitting the clouds part just use some simple collision detection. If you're referring to jetman you'll notice that the collision detection areas are rectangular because to actually make it detect collision with a random size polygon is very very difficult and to get it working by the end of ur school year is very unlikely. So you're likely to have the clouds randomly placed obviously right? So you're going to have to detect whether the helicopter crosses the cloud's path.

Therefore, the cloud is cX and cX+cL AND cY and cY+cH
the helicopter is hX and hX+hL AND hY and hY+hH:

So create if statements that will detect collision:
code:
if hX+hL>=cX AND hX+hL<=cX+cL AND hY+hH>=cY AND hY+hH<=cY+cH then


I mean that is very basic but you should get the point that if the top right point of the helicopter comes in contact with any part of the cloud between it's x-coor and x-coord + its length, or its y-coord and y-coord + height. It will do whatever you ask it to.

That should give you a head start on that part anyway,.
Insectoid




PostPosted: Thu Jun 05, 2008 11:19 am   Post subject: RE:Need help with helicopter game!(game similar to jetman)

To make the background move, just draw the picture and adjust the x-axis. When it gets to the end of the picture, draw it again, with the original x.
jeffgreco13




PostPosted: Thu Jun 05, 2008 11:43 am   Post subject: Re: Need help with helicopter game!(game similar to jetman)

If you're going to make your program like Jetman you've got a long haul ahead of you. If you're going to make the terrain random like that they once again it has to consist of many rectangles side by side at different lengths and coords. Mr Simeon Dorsey or w/e his name is had a slight advantage in his quest, he just copied the Helicopter Game source so he had the hard part finished. You've got to recode the entire thing yourself.

Best advice I can give is you're going to have to visualize what it's going to look like upon execution while you program it.

Good Luck tho, and by all means this is possible.
tanya kang




PostPosted: Thu Jun 05, 2008 7:53 pm   Post subject: Re: RE:Need help with helicopter game!(game similar to jetman)

insectoid @ Thu Jun 05, 2008 11:19 am wrote:
To make the background move, just draw the picture and adjust the x-axis. When it gets to the end of the picture, draw it again, with the original x.

I don't quite get what you mean...
like draw a box
and put the box on randint?
tanya kang




PostPosted: Thu Jun 05, 2008 7:57 pm   Post subject: Re: Need help with helicopter game!(game similar to jetman)

jeffgreco13 @ Thu Jun 05, 2008 10:07 am wrote:
My suggestion to you is that in order to make a true animation seach these forums for the tutorial on View.Update. This allows for flicker-free animation when redrawing the canvas over and over and over to simulate the movement.

For the helicopter hitting the clouds part just use some simple collision detection. If you're referring to jetman you'll notice that the collision detection areas are rectangular because to actually make it detect collision with a random size polygon is very very difficult and to get it working by the end of ur school year is very unlikely. So you're likely to have the clouds randomly placed obviously right? So you're going to have to detect whether the helicopter crosses the cloud's path.

Therefore, the cloud is cX and cX+cL AND cY and cY+cH
the helicopter is hX and hX+hL AND hY and hY+hH:

So create if statements that will detect collision:
code:
if hX+hL>=cX AND hX+hL<=cX+cL AND hY+hH>=cY AND hY+hH<=cY+cH then


I mean that is very basic but you should get the point that if the top right point of the helicopter comes in contact with any part of the cloud between it's x-coor and x-coord + its length, or its y-coord and y-coord + height. It will do whatever you ask it to.

That should give you a head start on that part anyway,.


hehe I actually don'
t wuite get it
I suck at turing
and the games actually due this MOnday
so I am pretty dead
but do you know how to make the helicopter move?
if i press mouse and it goes up and if I release it, it goes down.
I don't really get that part
Insectoid




PostPosted: Thu Jun 05, 2008 8:47 pm   Post subject: RE:Need help with helicopter game!(game similar to jetman)

You should read the jumping tutorial. It is confusing at first (At least for me; learning by reading code is something I do not do well at).
After you have read that, make an attempt at it on your program. If you have another problem, then ask and we might deliver (sometimes we don't...)

About the background, what would you need a random number for? Do you want to make the chopper move at random speeds? I assume you want horizontal movement?

Every picture is drawn with an X and a Y coordinate. I'll finish this post tomorrow as my mom is kicking me off...
Sponsor
Sponsor
Sponsor
sponsor
weebly




PostPosted: Thu Jun 05, 2008 10:30 pm   Post subject: RE:Need help with helicopter game!(game similar to jetman)

when the helicopter come close to the edges move the screen...
Insectoid




PostPosted: Fri Jun 06, 2008 7:40 am   Post subject: RE:Need help with helicopter game!(game similar to jetman)

Right, every picture is draw with an X and a Y coordinate. You can make a picture move by changing these values and redrawing. To make a picture move horizontaly, change the X value. To make it move vertically, change the Y value. Being a jetman type game, you will want the picture to move horizontally. So, every time you go through the main loop, change the X coordinate. When the right edge of the picture appears, draw a second copy of the same picture behind it. when a picture moves all the way off the screen, stop drawing it. This way, with 2 (long) variables and one picture, you can make a never-ending background.
chopperdudes




PostPosted: Fri Jun 06, 2008 5:13 pm   Post subject: Re: Need help with helicopter game!(game similar to jetman)

lol is this christina? sorry if it isn't, sounds like a person at my school doing the turing summative.

for the clouds, just set a set of arrays


var cloudx ( i ) : int := Rand.Int (maxx, 2*maxx) so that it appears before actually enter the screen, then just use x -=1
if x + Pic.Width (cloud ( i )) < 0 then reset cloudx ( i ) to Rand.Int (maxx, 2*maxx) again. so this way you'll only need like 10 clouds max.

then var cloudy (i) : int := Rand.Int (0, maxy - Pic.Height (cloud ( i ))




collision detection for simple shapes you can use whatdotcolor or Math.DistancePointLine. collision detection for irregular shapes are extremely hard (if not impossible) on turing.

but then again.. i'm still a noob lol
jeffgreco13




PostPosted: Mon Jun 09, 2008 8:52 am   Post subject: Re: Need help with helicopter game!(game similar to jetman)

keep in mind that background/canvas is moving on the x-axis while the helicopter is only moving on the y-axis. Together makes the moving up/down and left-to-right simulation.

Like the helicopter game, the collision detection is based on a rectangular field around each object. The rectangle should fit on you're imported picture as tightly as possible to ensure its realistic. That way when the field aroung the helicopter comes in contact with the field around the cloud, then you collision is detected. The cloud itself and the helicopter don't have a collistion listener its the rectangular fields around them.

Even if the project is overdue, give it a shot it's still great practice if you like Turing.
evildaddy911




PostPosted: Mon May 21, 2012 3:09 pm   Post subject: Re: Need help with helicopter game!(game similar to jetman)

i think that the only way irregular shapes collision is possible of turing is if 1 of the shapes is a circle, point, or box.
draw the irregular object in 1 uniform color, then, before you draw the regular one, go through each coordinate of the regular object, and use whatdotcolor to check if the that point is in the irregular object:

draw the irregular object in black, then,

if your regular is a box:
Turing:
for x : boxX1 .. boxX2
    for y : boxY1 .. boxY2
        if whatdotcolor(x,y)=black then
            % do stuff
        end if
    end for
end for


or a circle:
Turing:
for r : 1 .. radius
    var circumference : int := round (r * Math.PI )
    for i : 1 .. circumference
        if whatdotcolor(round (cosd (i * 360 / circumference ) * r + circleX ), round (sind (i * 360 / circumference ) * r +
                circleY ))=black then
                % do stuff
        end if
    end for
end for

NOTE: this does not check EVERY point in the circle due to rounding, but its pretty accurate

also, if your checking clouds and helicopters, then draw a bunch of white circles for the clouds and use them as your regular shape
Raknarg




PostPosted: Mon May 21, 2012 3:21 pm   Post subject: RE:Need help with helicopter game!(game similar to jetman)

a few years too late...
evildaddy911




PostPosted: Mon May 21, 2012 3:32 pm   Post subject: RE:Need help with helicopter game!(game similar to jetman)

oh, oops, forgot to check that...
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  [ 15 Posts ]
Jump to:   


Style:  
Search: