Ignore:
Timestamp:
Dec 23, 2002, 2:13:04 PM (18 years ago)
Author:
Sam Hocevar
Message:
  • ship has vx and vy.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ttyvaders/trunk/src/player.c

    r38 r58  
    44 *                 All Rights Reserved
    55 *
    6  *   $Id: player.c,v 1.4 2002/12/22 18:44:12 sam Exp $
     6 *   $Id: player.c,v 1.5 2002/12/23 13:13:04 sam Exp $
    77 *
    88 *   This program is free software; you can redistribute it and/or modify
     
    3232    p->x = g->w / 2;
    3333    p->y = g->h - 2;
    34     p->dir = 0;
     34    p->vx = 0;
     35    p->vy = 0;
    3536    p->weapon = 0;
    3637    p->nuke = 0;
     
    7273    }
    7374
    74     if( p->dir < 0 )
     75    p->x += p->vx;
     76
     77    if( p->vx < 0 )
    7578    {
    76         if( p->dir == -3 && p->x > -2 ) p->x -= 1;
    77         else if( p->x > -1 ) p->x -= 1;
     79        p->vx++;
     80    }
     81    else if( p->vx > 0 )
     82    {
     83        p->vx--;
     84    }
    7885
    79         p->dir++;
     86    if( p->x < 1 )
     87    {
     88        p->x = 1;
    8089    }
    81     else if( p->dir > 0 )
     90    else if( p->x > g->w - 7 )
    8291    {
    83         if( p->dir == 3 && p->x < g->w - 8 ) p->x += 1;
    84         else if( p->x < g->w - 7 ) p->x += 1;
    85         p->dir--;
     92        p->x = g->w - 7;
    8693    }
    8794}
Note: See TracChangeset for help on using the changeset viewer.