1234567891011121314151617181920212223242526 |
- /* This file is part of Invaders.
- *
- * Copyright (C) 2020 LCM.
- * You may use, distribute and modify Invaders under the terms of the
- * GPLv3 license, available at <https://www.gnu.org/licenses/\>.
- */
- #include "rocket.hpp"
- rocket::rocket(int X,int Y,int V) : bullet(X,Y,256){
- v=(V>=0?1:-1);
- }
- void rocket::next_pos(){
- y--;
- if(x==C-1 || x==0) v*=-1;
- switch(v){
- case 1:
- x++;
- break;
- case -1:
- x--;
- break;
- }
- }
|