//单个僵尸移动 void game_zombie_move(double& after_move_x, double& after_move_y, int start_move_x) { dbLoadImage("image\\background1.jpg",30); dbLoadImage("image\\SeedBank3.png",31); dbLoadImage("image\\SeedBank0.png",32); dbSprite(2,0,0,30); dbLoadImage("image\\Zombie_digger_head2.png",20); if(start_move_x==0) { dbSprite(1,after_move_x,after_move_y,20); dbSetSpritePriority(1,99); } else { dbSprite(1,after_move_x-10,after_move_y,20); dbSetSpritePriority(1,99); after_move_x = dbSpriteX(1); after_move_y = dbSpriteY(1); dbSprite(2,0,0,30); dbSprite(3,0,0,31); dbSprite(4,0,0,32); } }
bool MaudioButton::onSprite ( int pointX , int pointY ) { bool insideSprite; int upperX = dbSpriteX ( spriteNO ) - dbSpriteOffsetX ( spriteNO ); int upperY = dbSpriteY ( spriteNO ) - dbSpriteOffsetY ( spriteNO ); int lowerX = upperX + dbSpriteWidth ( spriteNO ); int lowerY = upperY + dbSpriteHeight ( spriteNO ); if ( pointX >= upperX && pointY >= upperY && pointX <= lowerX && pointY <= lowerY ) insideSprite = 1; else insideSprite = 0; return insideSprite; }
bool DBBitmapHelper::IsButtonClicked(int buttonID) { int mouseX = dbMouseX(); int mouseY = dbMouseY(); int width = dbSpriteWidth(buttonID); int height = dbSpriteHeight(buttonID); int x = dbSpriteX(buttonID); int y = dbSpriteY(buttonID); bool result = false; bool inButtonArea = false; if (mouseX > x && mouseX < (x + width)) { if (mouseY > y && mouseY < (y + height)) { inButtonArea = true; // The mouse is inside the button. // Now check for mouse clicks. if(dbMouseClick()==1) { //WindowsHelper::SetActiveCursor(LoadCursorFromFile("aero_arrow.cur")); return true; } } } if(inButtonArea) { WindowsHelper::SetActiveCursor(LoadCursorFromFile("aero_link.cur")); } //else //{ // WindowsHelper::SetActiveCursor(LoadCursorFromFile("aero_arrow.cur")); //} return false; }