Thread: what are photons in C?

  1. #1
    Unregistered
    Guest

    Unhappy what are photons in C?

    man...what does it take to make a simple photon structure?

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    >man...what does it take to make a simple photon structure?

    Brains. A computer. An operating system. A compiler.

    If you need help with it, please post more specific information on what you want to do.
    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.

  3. #3
    Unregistered
    Guest

    Cool

    whatever. anyway, msdos; c/c++;gaming;borland;the code.

  4. #4
    Unregistered
    Guest

    Cool

    alright, see...i've got this cough cough...disability. i read & took good notes on the entire 1st semester course in C. step by step. i just have this problem...where i have to go back afterwards and study the entire thing all over again...part for part...section for section by any means necessary...and i have most of it understood and in use...it's just i'm one of those people that take 5 years to learn a one semester course. well, it's a learning problem. i need hands on...man, hands on training...i can dooo so much with C...i just cannot make a photon weapon for a spaceship in msdos. i can do it...i've done it six different ways in the past...i want the standard way of creating "bullets" for my spacecraft this time...to bury it into my mind...as permanently as possible...the code...i have to have the code...i'm tired of doing it allllll wrong!!! help, man.

  5. #5
    Registered User
    Join Date
    Feb 2002
    Posts
    589
    And did you save it the last 6 times you did it? Show us how you did it then. It is always easier to start with something.

    >> want the standard way of creating "bullets" for my spacecraft this time<< I don't think the C standard say anything about photon weapons or bullets.

  6. #6
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    that leaves a lot of questions unanswered. are these bullets fast, or do they scroll across the screen like other projectiles?

    if you need help this badly for this, have done it five times before, and still cannot get it, you probably should find another occupation. (or hobby).

  7. #7
    Unregistered
    Guest
    well, they sucked. embarrassing. totally. they worked fine. it was back when i was using cleardevice(); like an idiot to make thing animate...just plain ignorant...e.g.


    putpixel(x,y,color); it just sucks i cannot even explain it...it would increment x or y, or both...in a plain shooting game firing straight upward...along the x axis. zzz...zzzz...now i have a ship that flies in circles...and i cannot get the bullet to even fly along....ahahahaha i suck sometimes...it's a mental block. i'll try to explain it again later...i just quit smoking cigarettes a week ago...typing kind of get to me right now...i'm going to take a break for bit...it was hit e.g. alt and it would launch the pixel into like an unlocked mode...then from there in the program there would be an incrementation of the y axis. really retarded like.

  8. #8
    Unregistered
    Guest
    i'm looking for fast bullets, they were not. actually, this hobby issss very very good for me...you see...i have some gift at it...like with anything else...i'm a god for 2 days...the rest of the week i'm a dolt...like today. i'm this way with everything there is in life....

  9. #9
    Unregistered
    Guest

    Cool

    well, you know...i cannot even beat the games i create these days...they are difficult. i have an imagination. i just have to continue to evolve in my practice...once i gain this photon ability...the evolution can take its toll...and rid my of these programming ills...it's the final process. for god's sakes man...please lend me a hand in my darkest hour...

  10. #10
    Unregistered
    Guest
    i don't know what that's all about; i found a thread on the subject of bullets though...so, it's physics? whooooowhooooooooo...big deal. you could have just said so. it's a start.

  11. #11
    Unregistered
    Guest
    #include <stdio.h>
    #include <math.h>
    #include <graphics.h>
    #include <conio.h>
    #include <dos.h>
    #define rotate 3
    #define speed 0.12

    typedef struct
    {
    float x, y;
    } vec;

    typedef struct
    {
    int num;
    vec array[3];
    } form;

    typedef struct
    {
    vec pixel;
    int view; // ship direction.
    vec move; // move direction.
    form make; // make form.
    form dos; // screen points.
    } image;

    image viper;

    void array(vec*dest,vec*scr,int degree) // return dest - points to x, y floats.
    {
    double rad; // radius.
    rad=degree*0.01745;
    dest->x=scr->x*cos(rad)-scr->y*sin(rad); // standard library functions.
    dest->y=scr->x*sin(rad)+scr->y*cos(rad);
    }

    void mode(image*var) // return value of type image.
    {
    int i;
    for(i=0;i<var->make.num;i++) // rotate.
    {
    array(&var->dos.array[i],&var->make.array[i],var->view);
    var->dos.array[i].x+=var->pixel.x;
    var->dos.array[i].y+=var->pixel.y;
    }
    }

    void draw(image*var)
    {
    int i;
    for(i=1;i<var->make.num;i++)
    {
    line(var->dos.array[i-1].x,var->dos.array[i-1].y,
    var->dos.array[i].x,var->dos.array[i].y);
    }
    line(var->dos.array[i-1].x,var->dos.array[i-1].y,
    var->dos.array[0].x,var->dos.array[0].y);
    }

    void power(image*var)
    {
    var->pixel.x+=var->move.x;var->pixel.y+=var->move.y; // move.
    if(var->pixel.x<0)var->pixel.x=var->pixel.x+640; // border.
    if(var->pixel.x>639)var->pixel.x=var->pixel.x-640;
    if(var->pixel.y<0)var->pixel.y=var->pixel.y+480;
    if(var->pixel.y>479)var->pixel.y=var->pixel.y-480;
    }

    void hold(){while(inp(0x3da)&8);while(!(inp(0x3da)&8)); } // prevent flash.

    void init(void)
    {
    int GraphicsDriver=VGA;
    int GraphicsMode=VGAHI;
    initgraph(&GraphicsDriver,&GraphicsMode,NULL);
    setwritemode(XOR_PUT);
    viper.make.num = 3;
    viper.make.array[ 0 ].x = 0; viper.make.array[ 0 ].y = -16; // coords.
    viper.make.array[ 1 ].x = -8; viper.make.array[ 1 ].y = +8;
    viper.make.array[ 2 ].x = +8; viper.make.array[ 2 ].y = +8;
    viper.view = 0; viper.pixel.x = 320; viper.pixel.y = 240; // center.
    viper.move.x = 0; viper.move.y = 0;
    }

    void main(void)
    {
    int c=0; unsigned short keyboard;
    init();
    while(c!='q'&&c!='Q')
    {
    mode(&viper);draw(&viper);
    keyboard = *(unsigned short far *)MK_FP( 0x40, 0x17 );
    power(&viper);
    if(kbhit()){c=getch();}
    if(keyboard&0x0002)
    {viper.view-=rotate;if(viper.view<0)viper.view=360-rotate;}
    if(keyboard&0x0001)
    {viper.view+=rotate;if(viper.view>359)viper.view=0 +rotate;}
    if(keyboard&0x0008)
    {
    double rad; rad = viper.view*0.01745;
    viper.move.x+=sin(rad)*speed;viper.move.y-=cos(rad)*speed;
    }
    hold();draw(&viper);

    }
    closegraph();
    }

  12. #12
    Unregistered
    Guest
    alright, now how do i make this spaceship fire bullets?

  13. #13
    Just because ygfperson's Avatar
    Join Date
    Jan 2002
    Posts
    2,490
    by asking nicely and using code tags

    and asking the moderator to delete all your nonsense posts

  14. #14
    Unregistered
    Guest
    moderator please delete my "nonsense" posts.

  15. #15
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Done.

    First of all, we know nothing about your project. Please sort your thoughts and questions, assume we don't have your knowledge and repost them. Use short sentences and paragraphs, so we can easily follow your train of thought.

    What do you want to do ?
    What did you do ?
    What happened ?
    What would you like to change ?
    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.

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, 05: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