00001 /* 00002 * Marshmallow Duel DS v2 00003 * Copyright © 2007 Sam Pospischil http://pospi.spadgos.com 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU General Public License as published by 00007 * the Free Software Foundation; either version 2 of the License, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU General Public License 00016 * along with this program; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 */ 00019 00020 #ifndef _WPWEASELPROJ_H 00021 #define _WPWEASELPROJ_H 00022 00023 #include <PA9.h> 00024 #include "macros.h" 00025 #include "massObject.h" 00026 00027 //forward declaration 00028 class Player; 00029 00030 class wp_weasel_proj : public massObject 00031 { 00032 public: 00033 wp_weasel_proj(spriteManager* newsm, Player* p); 00034 virtual ~wp_weasel_proj(); 00035 00036 virtual void updateSprite(); 00037 00038 private: 00039 Player* owner; 00040 00041 static const s8 standingBounds[]; 00042 static const s8 hangingBounds[]; 00043 static const s8 fallingBounds[]; 00044 00045 static const u8 INITIALDELAY = 45; 00046 static const u16 WALKSPEED = 384; 00047 static const u8 WALKANIMSPEED = 6; //like ticksperframe 00048 static const u8 HANGDELAY = 30; 00049 00050 u16 idleTime; 00051 bool justStoppedIdling; //animation helper 00052 00053 void setIdlePeriod(u16 framesToWait) {idleTime = framesToWait;} 00054 void runLeft() {setFlipped(false, false); vx = WALKSPEED*-1;} 00055 void runRight() {setFlipped(true, false); vx = WALKSPEED;} 00056 void changeDirection() 00057 { 00058 if (!isOnGround()) 00059 return; 00060 if (vx < 0) 00061 runRight(); 00062 else if (vx > 0) 00063 runLeft(); 00064 else if (vx == 0) 00065 { 00066 if (!flippedh) 00067 runLeft(); 00068 else 00069 runRight(); 00070 } 00071 } 00072 bool atEdge(); //detect if we are about to fall off a platform 00073 00074 void playWalking(); 00075 void playFalling(); 00076 void hangDown(); 00077 00078 void playRandomSnarl(); 00079 }; 00080 00081 #endif