double x=0.0, y=0.0;
value>>x;
value>>y;
+
/** Collision data */
char c;
/** sets frame delay and makes sure height and width are correct */
mAnim[count].pause = pause;
- if(!mW) mW = mAnim[count].image->w;
- if(!mH) mH = mAnim[count].image->h;
+ mW = mAnim[count].image->w;
+ mH = mAnim[count].image->h;
/** Set the animation Peg*/
- mAnim[count].animationPeg = Point2D(x,y);
+ mAnim[count].animationPeg = Point2D(x + double(mW)/2, y + double(mH)/2);
count++;
}
}
}
- /// \todo add collision info obtained from file.
fin.close();
return 0;
}
#ArtAssets/ milisec Transparency
#filename pause r g b xOffset yOffset ( collisionType <Circle has offset, radius | rectangle has offset, width, height>, ... )
NumFrames: 4
-sun1.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 0.0 )
-sun2.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 0.0 )
-sun3.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 0.0 )
-sun4.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 0.0 )
+sun1.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 10.0 )
+sun2.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 10.0 )
+sun3.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 10.0 )
+sun4.bmp 20 0 0 255 0.0 0.0 ( c 0.0 0.0 10.0 )
#ArtAssets/ milisec Transparency
#filename pause r g b xOffset yOffset ( <n | c | r> <Circle has offset, radius | rectangle has offset, width, height>, ... )
NumFrames: 9
-viking1.bmp 50 0 255 0 0.0 0.0 ( r 0.0 0.0 150.0 100.0 )
-viking2.bmp 50 0 255 0 0.0 0.0 ( r 0.0 0.0 150.0 100.0 )
-viking3.bmp 50 0 255 0 0.0 0.0 ( r 0.0 0.0 150.0 100.0 )
-viking4.bmp 50 0 255 0 0.0 0.0 ( r 0.0 0.0 150.0 100.0 r -6.0 3.0 5.0 5.0 )
-viking5.bmp 50 0 255 0 0.0 0.0 ( r 0.0 0.0 150.0 100.0 )
-viking6.bmp 50 0 255 0 0.0 0.0 ( r 0.0 0.0 150.0 100.0 )
-viking7.bmp 50 0 255 0 0.0 0.0 ( r 0.0 0.0 150.0 100.0 )
-viking8.bmp 50 0 255 0 0.0 0.0 ( r 0.0 0.0 150.0 100.0 )
-viking9.bmp 50 0 255 0 0.0 0.0 ( r 0.0 0.0 150.0 100.0 )
+viking1.bmp 50 0 255 0 0.0 0.0 ( r -75 -50 150.0 100.0 )
+viking2.bmp 50 0 255 0 0.0 0.0 ( r -75 -50 150.0 100.0 )
+viking3.bmp 50 0 255 0 0.0 0.0 ( r -75 -50 150.0 100.0 )
+viking4.bmp 50 0 255 0 0.0 0.0 ( r -75 -50 150.0 100.0 c 0.0.0 5.0 )
+viking5.bmp 50 0 255 0 0.0 0.0 ( r -75 -50 150.0 100.0 )
+viking6.bmp 50 0 255 0 0.0 0.0 ( r -75 -50 150.0 100.0 )
+viking7.bmp 50 0 255 0 0.0 0.0 ( r -75 -50 150.0 100.0 )
+viking8.bmp 50 0 255 0 0.0 0.0 ( r -75 -50 150.0 100.0 )
+viking9.bmp 50 0 255 0 0.0 0.0 ( r -75 -50 150.0 100.0 )
struct SpriteFrame{
SDL_Surface *image;/**< Pointer to an image. */
int pause;/**< Tells the amount of time to pause between this frame and the next. */
- int width;/**< Base width of the frame's image. */
- int height;/**< Base height of the frame's image. */
+ int width;/**< Base width of the frame's image. \todo make this and animation's match or at least sync or delete*/
+ int height;/**< Base height of the frame's image. \todo make this and animation's match or at least sync or delete*/
vector<Point2D> hotSpots;/**< Hot spots that can be used for locating objects on the sprite default is tagged to center of the sprite \todo implement default*/
Point2D animationPeg;/**< The offeset from position to place the image. Defaults to (0,0) \todo implement */
vector<Collision*> collisionData;/**< The collision data for this sprite */
if(mVisible == true)
SDL_BlitSurface(frame.image,NULL,mScreen,&dest);
if(Game::game()->ShowCollisions)
- drawCollisions(frame.collisionData, frame.animationPeg);
+ drawCollisions(frame.collisionData, mPos + frame.animationPeg);
}