Advertisement

Object oriented 2d fighters

Started by September 28, 2000 12:56 PM
1 comment, last by Mader 24 years, 2 months ago
Hi all! I''m having trouble with my Structures. I have 3 structures that are like this: BOB needs the struct ANIMATIONINFO and ANIMATIONINFO needs the struct in ANIMATIONFRAMEINFO BOB |-> ANIMATIONINFO |->ANIMATIONFRAMEINFO The problem is when i access any other property than in the struct BOB,, the game crashes! I know this for sure, the bug is here: //a loop in my create bob function for (index=0; indexanimations[index]->max_anim_frame = 0; MessageBox(main_window_handle,"anim intitialize done", "tit", MB_OK); } I never receve the msgbox,, so it crashes here here are the struct: typedef struct ANIMATIONFRAMEINFO_TYP { int anim_frame; //current frame RECT colisionbox1; // For colision detection RECT colisionbox2; // RECT attackbox1; // int time; //number of miliseconds the frame(or image) will be displayed int damage; int defence; int priority; }ANIMATIONFRAMEINFO_OBJ, * ANIMATIONFRAMEINFO_OBJ_PTR; typedef struct ANIMATIONINFO_TYP { ANIMATIONFRAMEINFO_OBJ *animation[1] ; //The number of the frames are here. First the index animation, second the frame index int max_anim_frame; //Total frame in this animation }ANIMATIONINFO_OBJ, * ANIMATIONINFO_OBJ_PTR; typedef struct BOB_TYP { int attributes; // Special attributes int state; //the state of the bitmap object, alive, dead, ko, Dizzy int action1; //Bob''s displacment, walk, swim, fly,falling int action2; //Bob''s move, defend up, attack7, parry down int x,y; //absolute posision of the bob,, used in the display int vx,vy; //Velocity of the bob int width, height; //dimension of the bob int counter; //General counter int num_frames; //Total number of frame int num_anim; //total number of animations int curr_frame; //Index of current animation frame int curr_anim; //Index of current animation LPDIRECTDRAWSURFACE7 image[MAX_BOB_FRAMES]; //Offscreen surface where the bitmap is in ANIMATIONINFO_OBJ *animations[MAX_BOB_ANIMATIONS];//Animations }BOB_OBJ, *BOB_OBJ_PTR; Each time i do mybob->animations[index]->max_anim_frame = 0; the app crashes. how comme? This is the best method i could find to make a good frame heavy 2d fighting game, I used some code from window game pro for dum(by andrée) thanks
http://www.fighterX.com
I would guess you haven''t allocated memory for the animations, am I right?

-------------------------------
That's just my 200 bucks' worth!

..-=gLaDiAtOr=-..
Advertisement
mmmm, I would guess you did allocate your message to the *WRONG FORUM* That''s why !
-----------------------------Sancte Isidore ora pro nobis !

This topic is closed to new replies.

Advertisement