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

Username:   Password: 
 RegisterRegister   
 Where to begin my 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: Thu Mar 16, 2006 12:06 pm   Post subject: Where to begin my game?

I posted here a while back about an asteroids game I wanted to make. It will be my first game. I read arrays and all the stuff that was suggested to me and I think I've got it down. I am ready to start coding. I wanted to start simply with the ship and getting it to spin and fire the misiles. I will have the ship stay in the middle and not be able to move as it gets much too complicated that way. I'll work on getting the asteroids to come later on and my ship in the beginning would probably be a crappy triangle or something until I get the movement down. After that I'll make it look better. My question is...would that be a good place to start? Or should I start with the asteroids first?
Sponsor
Sponsor
Sponsor
sponsor
Imm0rtal




PostPosted: Thu Mar 16, 2006 12:47 pm   Post subject: (No subject)

The laser should be interesting.. You need to get the coordinates your ship is facing and then use simple math to determind all the coordinates infront of the ship at that moment and have a loop of the laser firing.. Or at least thats what I would do..

Sounds interesting.. I prefer RPG's myself. Surprised
Reality Check




PostPosted: Thu Mar 16, 2006 1:17 pm   Post subject: (No subject)

I have the code in my head. I think I know pretty much how I am going to do it. This is my first game and if I have troubles I'll just ask for help. I'm just asking if thats a good place to start? I'm going to submit the ship when I am done but remember, my ship will be a crappy triangle, no sounds added, no background, just the misile firing (upon spacebar being pressed) and the ship spinning on spot. My misile in the beginning will probably be a dot or a small line, I'll make it look nice once I got the code down.
Tony




PostPosted: Thu Mar 16, 2006 1:44 pm   Post subject: (No subject)

Don't worry about graphics, start with most basic shapes - triangle for spaceship, line for missile, circle for asteroid. Once you know all the important points, you can slap images on top later.

Imm0rtal wrote:
have a loop of the laser firing.. Or at least thats what I would do..

Don't do that, else you'll be stuck in a situation where nothing but a single missile moves on the screen.

Have a single "game loop" where you move everything a single step at a time. So you want to have something like
code:

loop
   move_ship
   for i:0..num_missiles
      move_missile(i)
   end for
   for i:0..num_asteroids
      move_asteroid(i)
   end for
   check_for_collision
end loop

never
code:

loop
   move_missile
   exit when collision
end loop

<_< never Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
NikG




PostPosted: Thu Mar 16, 2006 4:57 pm   Post subject: (No subject)

Tony's right about the single game loop. In a game like asteroids, you need multiple missiles or the game would be boring.

Like Imm0rtal said, it should be interesting, and not too hard.
The hardest thing I foresee is collision detection, which could be very simple or pretty comlicated based on the shapes of the asteroids you choose to make.

I'm not sure on what other people think, but personally I would start with the ship as well. And yes, I would just use a simple triangle (hell, i've played several versions of the game which kept the ship as a triangle, so it's not even necessary to change it).

Next I would work on the shooting code, make sure you can aim at any angle. Then maybe a little preliminary collision detection (some people like whatcolor for this, but I'd prefer coding the actual coordinates myself).

Then I would start with the asteroids. I'm wondering whether it's possible to have an asteroid generator procedure (random shapes, sizes...).

Sounds like it could be a lot of fun.
Good luck.
Reality Check




PostPosted: Thu Mar 16, 2006 6:14 pm   Post subject: (No subject)

I plan to have my asteroids a picture that I make in Photoshop actually. I'll convert it to JPG. So the asteroid will have curves and whatnot and the ship too as I will make that too. I know I'm probably going to have a really hard time getting the collision detection on the curves and stuff so when and if that problem occurs I'll ask!
Imm0rtal




PostPosted: Thu Mar 16, 2006 6:34 pm   Post subject: (No subject)

Tony wrote:
Don't worry about graphics, start with most basic shapes - triangle for spaceship, line for missile, circle for asteroid. Once you know all the important points, you can slap images on top later.

Imm0rtal wrote:
have a loop of the laser firing.. Or at least thats what I would do..

Don't do that, else you'll be stuck in a situation where nothing but a single missile moves on the screen.

Have a single "game loop" where you move everything a single step at a time. So you want to have something like
code:

loop
   move_ship
   for i:0..num_missiles
      move_missile(i)
   end for
   for i:0..num_asteroids
      move_asteroid(i)
   end for
   check_for_collision
end loop

never
code:

loop
   move_missile
   exit when collision
end loop

<_< never Wink


Twisted Evil To be honest.. I didn't mean either..
NikG




PostPosted: Thu Mar 16, 2006 8:08 pm   Post subject: (No subject)

So just to clarify, you'll have one (or maybe a couple) standard shape(s) made in photoshop for the asteroids?
And ya, it seems collision detection might be a problem with that approach.

Personally, since I like Turing's draw tools, I would try and create some sort of procedure that can create random shapes of the asteroids. It sounds tricky but I would think it's do-able if you pass some random variables into drawpolygon.
i.e. random var to keep track of how many sides to the shape, random generator for coordinates (with some strict max and min rules), and save all that in an array. It'll make collision detection easier and more accurate.
Sponsor
Sponsor
Sponsor
sponsor
Cervantes




PostPosted: Thu Mar 16, 2006 8:29 pm   Post subject: (No subject)

NikG wrote:
So just to clarify, you'll have one (or maybe a couple) standard shape(s) made in photoshop for the asteroids?
And ya, it seems collision detection might be a problem with that approach.

If the shapes are mostly circular, you can treat them as circles for the purposes of collision detection, and no one will not the difference. Neutral
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: