that is the simplest version of the game.
it's finished version is complete with 3 levels of asteroids.
i waited until after creating the asteroids to add weapons.
you ramm them to break them up.
now, i want a weapon to shoot them with.
i get distracted; & then my logic just shuts off; and i go to sleep.
it's got to be some kind of mental disorder. the question is simple. the answer is too. a pixel that travels from the ship forward view.
Okay, I take a bit of guessing again. Note that if this isn't helpful, you need to give more information, I fire shots in the dark here.
You have a linked list of objects. Maybe two, one for asteroids, one for ship(s). Each object has a speed and a direction. Each object has a graphical representation.
Now make a third kind of object called shot. Keep it in the same storage structure as the asteroids i.e. make it a list of it's own or keep all your objects in one list. Each time your ship fires, create a new object of type shot, with a certain speed and the direction of the ship at this moment. Add it to the list of objects.
Add another run of your collision detection to see when shots hit asteroids and add your routine that simulates asteroids getting hit ( doesn't really matter if hit by ship or shot ). Also, watch for shots going off-screen. These can be removed from the list.
Add the shots to your drawing loop.
that sounds correct; i'll give it a shot. thanks.
i still say it's a pain in the arse...the prog. has everything it needs to make it happen...i mean if you considered the ship as a bullet itself...and then just duplicate it and make it just a pixel....it's now a bullet...right?
to put it in another language: would somebody please change that spaceship into a bullet? please tell me there is a god....
would it help if i told you i'm an ozzy fan?
iron maiden? judas priest?
If your thoughts are as disorganized as your postings here, you will never get it done. Stop it. Think about it. Stay calm. Panic doesn't help you. Shots in the dark won't help you. You need a concept. Make a concept first. Have you read my last post ? Have you implemented it ? If so, how about answering my questions again on this base:
What do you want to do ?
What did you do ?
What happened ?
What would you like to change ?
You will see, these are the questions that you need to answer. If you learn to answer these for yourself, we will be able to help you.
an advice: how abt being a bit low on the use of "."'s. Makes your post and you look real confused.
sorry, i can't help you. i have no idea where to begin. i don't want to read through all that. i don't know you organized your game enviroment. you are the best person to give a solution to your problem.
off the top of my head:
speed of bullet = speed of ship + bullet velocity when ship is at rest
i'm assuming the speed of the bullet is constant, and the bullet has no force against the ship which would cause the ship to slow down.
... and for a third time:
>Have you read my last post ? Have you implemented it ?
You are avoiding communication. If you don't want to implement it, tell me. If you have problems to implement it, tell me where. Posting the same question again won't help.
Answers to my questions:
You are doing an Asteroids clone.
You have a spaceship.
You have asteroids.
You have collision detection.
You need bullets.
A bullet is created whenever the player presses a key. It has an graphical display of it's own, just like an asteroid or spaceship. It has a set velocity. It has the vector of the spaceship while firing. It moves as everything else does.
What exactly is the part you have problems with ? I can't help you implement it if you don't give details.
I will not tell you how your code should look, because I'm not interested in sticking my head into a pile of DOS code. What I can do is help you with the concept.
You have asteroids. Moving objects.
You have a ship. Moving object.
You want to have shots. Moving objects.
Patterns. Do you see them ?
Each moving object has
a position vector
a velocity vector
You have a bunch of objects moving around your screen. Each time the user presses the key, another object of type 'shot' is added.
Your gameloop might look like this:
while user did not quit and ship did not collide
...for each object,
......check for collisions and handle event
......move object ( position = position + velocity )
...if user pressed key
......if key = fire, add new shot to list of objects
......if key = direction, change ships velocity
If you have problems with this, please post a specific question without code, or a clear coding question that involves not more than ten lines.