what are photons in C?

This is a discussion on what are photons in C? within the A Brief History of Cprogramming.com forums, part of the Community Boards category; that is the simplest version of the game. it's finished version is complete with 3 levels of asteroids. i waited ...

  1. #16
    Unregistered
    Guest

    Thumbs down

    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.
    just nevermind.

  2. #17
    Unregistered
    Guest
    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.

  3. #18
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    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.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  4. #19
    Unregistered
    Guest
    that sounds correct; i'll give it a shot. thanks.

  5. #20
    Unregistered
    Guest

    Thumbs down

    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?

  6. #21
    Unregistered
    Guest

    Talking

    to put it in another language: would somebody please change that spaceship into a bullet? please tell me there is a god....

  7. #22
    Unregistered
    Guest
    would it help if i told you i'm an ozzy fan?

  8. #23
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    Nope.

  9. #24
    Unregistered
    Guest
    iron maiden? judas priest?

  10. #25
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    STOP

    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.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  11. #26
    Registered User
    Join Date
    Aug 2001
    Posts
    46
    seditee:
    an advice: how abt being a bit low on the use of "."'s. Makes your post and you look real confused.

  12. #27
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,493
    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.

  13. #28
    Registered User seditee's Avatar
    Join Date
    Apr 2002
    Posts
    82
    i'm speechless.
    lebios

  14. #29
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    ... 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.

    My solution:
    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.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  15. #30
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    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
    an image


    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 )
    ......display object
    ...end each
    ...if user pressed key
    ......if key = fire, add new shot to list of objects
    ......if key = direction, change ships velocity
    ...end if
    end while


    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.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Page 2 of 3 FirstFirst 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Time to get those night-vision contacts
    By hk_mp5kpdw in forum A Brief History of Cprogramming.com
    Replies: 14
    Last Post: 01-22-2004, 04:53 PM
  2. Physics question
    By Panopticon in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 06-09-2003, 11:06 PM
  3. quantum mechanics
    By Silvercord in forum A Brief History of Cprogramming.com
    Replies: 22
    Last Post: 05-08-2003, 07:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21