本文整理汇总了C++中Fleet::asignBullet方法的典型用法代码示例。如果您正苦于以下问题:C++ Fleet::asignBullet方法的具体用法?C++ Fleet::asignBullet怎么用?C++ Fleet::asignBullet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fleet
的用法示例。
在下文中一共展示了Fleet::asignBullet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main ( int argc, char** argv ){
if ( SDL_Init( SDL_INIT_EVERYTHING ) < 0 ) {
printf( "Unable to init SDL: %s\n", SDL_GetError() );
return 1;
}
// make sure SDL cleans up before exit
atexit(SDL_Quit);
// create a new window
screen = SDL_SetVideoMode(900, 600, 8, SDL_HWSURFACE|SDL_DOUBLEBUF);
if ( !screen ) {
printf("Unable to set 640x480 video: %s\n", SDL_GetError());
return 1;
}
Fleet f;
Bullet b3;
f.asignBullet(&b3);
Barrier bar1(000,98,1);
/* Barrier bar2(000,200,1);
Barrier bar3(000,300,1);
Barrier bar4(000,400,0);
Barrier bar5(000,500,0);
Barrier bar6(000,599,0);*/
Ship s2;
s2.position( (GAME_W /2) + 100 ,GAME_H-30);
//s2.setMode(2);
Bullet b2;
b2.setDownOrientation();
s2.asignBullet(&b2);
Ship s1;
//s1.setMode(1);
s1.position( (GAME_W / 2)- 100 , GAME_H-30);
Bullet b1;
s1.asignBullet(&b1);
SideBar sb;
actors.push_back(&b1);
actors.push_back(&b2);
// actors.push_back(&b3);
// actors.push_back(&f);
actors.push_back(&bar1);
Bonus bonus;
actors.push_back(&bonus);
actors.push_back(&sb);
Stairs stairs(160,98,1);
actors.push_back(&stairs);
actors.push_back(&s1);
actors.push_back(&s2);
Uint8 * keystate;
bool done = false;
while (!done)
{
//Start the frame timer
fps.start();
keystate = SDL_GetKeyState(NULL);
if(keystate[SDLK_LEFT]) {
//if(!s1.climbing){
s1.moveLeft();
//}
}
if(keystate[SDLK_RIGHT]) {
s1.moveRight();
}
if(keystate[SDLK_UP]) {
int collided = 0;
if(s1.onGround){
for (int i=0; i<Stairs::SHIPS_QTY; i++) {
if (check_collision(s1.rect,stairs.rect[i])) {
s1.climbing = true;
s1.moveUp();
collided = 1;
//std::cout << "Climbing en true??" << s1.climbing << "\n";
}
}
if(!collided){
std::cout << "ELSEClimbing en true??" << s1.climbing << "\n";
s1.climbing= false;
//.........这里部分代码省略.........