Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Object.h"
- Object::Object()
- {
- Img_Surface = NULL;
- PosX = 0;
- PosY = 0;
- MaxJump = 10;
- CurrentFrame[0] = 0;
- CurrentFrame[1] = 0;
- State = STATE_PASSIVE;
- }
- bool Object::Init(char *File)
- {
- PosX = 0;
- PosY = 0;
- IMGFile = File; //START COMMENT HERE
- if((Img_Surface = MySurface::OnLoad(File)) == NULL)
- {
- return false;
- }
- MySurface::Transparent(Img_Surface, 255, 0, 255);
- //END COMMENTER HERE
- return true;
- }
- int Object::RetrievePosX()
- {
- return PosX;
- }
- int Object::RetrievePosY()
- {
- return PosY;
- }
- int Object::RetrieveFrameByID(int ID)
- {
- switch(ID)
- {
- case 0:
- return CurrentFrame[0];
- case 1:
- return CurrentFrame[1];
- }
- return 0;
- }
- void Object::SendAnimation()
- {
- Animate.Anima();
- }
- void Object::ReceiveEvent(int Event, int Direction)
- {
- if(Event == EVENT_STOP)
- {
- Animate.Working = false;
- }
- else if(Event == EVENT_WALK)
- {
- Animate.Working = true;
- Animate.Direction = Direction;
- }
- }
- void Object::GetValues()
- {
- PosX = Animate.retrievePosX();
- PosY = Animate.retrievePosY();
- int CFrameID = Animate.GetCurrentFrame();
- CurrentFrame[0] = (CFrameID / 3) * 64;
- CurrentFrame[1] = (CFrameID % 3) * 64;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement