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

Username:   Password: 
 RegisterRegister   
 Trying to make "Asteroids" game...
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Reality Check




PostPosted: Tue Mar 07, 2006 5:48 pm   Post subject: Trying to make "Asteroids" game...

Ok, I am in grade 10 and learned Turing about 5 months ago. Obviously for my ISP I need to make a game. I didn't want to make any crappy trivia game (like most are doing in my class) but I wanted to do something harder. So I thought of Asteroids (you know the game with the spaceship in the middle and the asteroids coming). Before I have even started I'd like to work out the kinks and I have a few questions.

How would I go about knowing when the asteroid hits the spaceship? I want there to be 3 lives, and you lose 1 each time you get hit. Do I need to do some collision detect (have no idea how) or could I simply pre-dictate the Co-ordinates of my spaceship (since it will simply be spinning on its spot and not moving). So when the asteroids co-ordinates touch the spaceships co-ordinates it will subtract one life. Not sure if that'd work though (remember I'm sort of a noob).

My second question is, how do I go about splitting the big asteroids when they get hit with the misile? In the original game, when you hit an asteroid, it splits into 2 smaller ones and continues to fly at you until you destroy it enough.

Other than that the scoring system, the lives, the colour, the moving, and all is worked out. I know this is really hard for my first game but my ISU is due in like 4 months so if its too hard I could always give up and just do pong...
Sponsor
Sponsor
Sponsor
sponsor
batman




PostPosted: Tue Mar 07, 2006 6:00 pm   Post subject: Asteriod Game

Wouldn't the teacher give you bad marks for doing an asteroid game? Its already been done in turing. If you check the turing files on your computer there are three games that come with turing one of which are an asteroid game. The teacher might think your copying off that one! Very Happy
Reality Check




PostPosted: Tue Mar 07, 2006 6:31 pm   Post subject: (No subject)

I assure him and you that I will not look at the examples at ALL. Not even to look at and learn from. Completely from scratch done my way. He can check it and see that the two are completely different.
do_pete




PostPosted: Tue Mar 07, 2006 7:11 pm   Post subject: (No subject)

A simple way to do the collision detection is to check whether the distance between the center of the ship and the asteroid is smaller than the radius of the ship added to the radius of the asteroid.
Delos




PostPosted: Tue Mar 07, 2006 7:12 pm   Post subject: Re: Trying to make "Asteroids" game...

Reality Check wrote:
Ok, I am in grade 10 and learned Turing about 5 months ago. Obviously for my ISP I need to make a game. I didn't want to make any crappy trivia game (like most are doing in my class) but I wanted to do something harder. So I thought of Asteroids (you know the game with the spaceship in the middle and the asteroids coming). Before I have even started I'd like to work out the kinks and I have a few questions.

How would I go about knowing when the asteroid hits the spaceship? I want there to be 3 lives, and you lose 1 each time you get hit. Do I need to do some collision detect (have no idea how) or could I simply pre-dictate the Co-ordinates of my spaceship (since it will simply be spinning on its spot and not moving). So when the asteroids co-ordinates touch the spaceships co-ordinates it will subtract one life. Not sure if that'd work though (remember I'm sort of a noob).

My second question is, how do I go about splitting the big asteroids when they get hit with the misile? In the original game, when you hit an asteroid, it splits into 2 smaller ones and continues to fly at you until you destroy it enough.

Other than that the scoring system, the lives, the colour, the moving, and all is worked out. I know this is really hard for my first game but my ISU is due in like 4 months so if its too hard I could always give up and just do pong...


Hello. Yes, this is a challenging project for someone with as little experience as you. However, that being said, it is by no means impossible. All you need is a little determination, copious amounts of time, and the ability to handle frustration really well. Oh, and a bit of maths, don't forget the maths.
We'll start with the basics. You have 4 months, this is ample time for you to learn all the skills you need to tackle this. Over the next little bit of that time, I suggest you learn to use the Search Button up top there, so you don't find yourself asking questions that people will look at and say, "Boy, that's silly. The answer to it is readily available!" Not saying that these questions are silly...but just in case.
I'm guessing you know the rules of the site, otherwise just read [The Rules]. Again, useful stuff in there.

Now that that's out of the way.
Collision detection: yes, you will need this. Luckily for you, there are a number of tuts on the subject. Both on linear and circular detection, which is exactly what you need. Look at [Turing Tutorials] and the [Turing Walkthrough] for more info.
As for the splitting of asteroids...this is not as simple as the game makes it out to be. Or was it that it's simpler than you think...hmm...
The idea here is that you'll be working with a parent asteroid that, when given the signal, will disappear and in its stead create two daughter asteroids. All other things like their directions, sizes, velocities, will follow later on. For you to be able to efficiently and effectively carry this out, you will need a solid understanding of the following (not an exhaustive list):
- arrays, specifically flexible
- types and records
- procedures and functions. Focus on the latter
- and the usual if structures, loops, and so forth.

Once again, this info is accessible in the Tuts section. These will be your lifeblood. Treat them well.

Since it is so early on in your project, there's not too much else to be said (though it likely will...). Get coding, and when you run into a major problem, post up a question. Remember to include your code (either attached or in [code] tags).

Good luck.
chrispminis




PostPosted: Tue Mar 07, 2006 8:07 pm   Post subject: (No subject)

Hmm. In Asteroids, you didn't just spin around in a circle... That's just what most people did because it was the safest way to go. You could actually thrust, and move forward I believe. Although this would complicate your project quite a bit, since its quite unique movement, and it does involve acceleration so its exponential.
Reality Check




PostPosted: Tue Mar 07, 2006 8:36 pm   Post subject: (No subject)

Thanks alot. I'll get started during the March Break and I'll read about all the subjects you posted. I think I'll stick with you not being able to move the spaceship because then it gets much too complicated. Although, I still don't get how the whole splitting of the asteroids is going to work since it needs to know the direction, and angle that it comes out at. Either way, the help was of great use and I'll read up all the topics you told me too. See you when I run into problems Smile
md




PostPosted: Tue Mar 07, 2006 8:56 pm   Post subject: (No subject)

chrispminis wrote:
Hmm. In Asteroids, you didn't just spin around in a circle... That's just what most people did because it was the safest way to go. You could actually thrust, and move forward I believe. Although this would complicate your project quite a bit, since its quite unique movement, and it does involve acceleration so its exponential.


Exponential? I think if you accelerate in a strait line you'll see that the velocity increases at a linear rate. Though to do it properly you need to use things like sine and cosine so it's still not easy.
Sponsor
Sponsor
Sponsor
sponsor
Reality Check




PostPosted: Tue Mar 07, 2006 9:38 pm   Post subject: (No subject)

Yea theres no problem in the Math department. I'm really good at it so calculating everything would be a sinch...its just the 'how' that I need to learn.
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  [ 9 Posts ]
Jump to:   


Style:  
Search: