Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » help for coding in sprite animation

This thread is locked; no one can reply to it. rss feed Print
help for coding in sprite animation
badboy1986
Member #11,958
May 2010

#SelectExpand
1#include <stdio.h> 2#include <allegro.h> 3#include "loadpng.h" 4 5 6#define MODE GFX_AUTODETECT_WINDOWED 7#define WIDTH 800 8#define HEIGHT 600 9#define WHITE makecol(255,255,255) 10 11//timer variables 12volatile int counter; 13volatile int ticks; 14volatile int framerate; 15volatile int resting, rested; 16 17//calculate framerate every second 18void timer1(void){ 19 counter++; 20 framerate = ticks; 21 ticks=0; 22 rested = resting; 23} 24END_OF_FUNCTION(timer1) 25 26//do something while resting (?) 27void rest1(void){ 28 resting++; 29} 30 31/*//define the sprite structure 32typedef struct SPRITE 33{ 34 int x,y; 35 int width,height; 36 int xspeed,yspeed; 37 int xdelay,ydelay; 38 int xcount,ycount; 39 int curframe,maxframe,animdir; 40 int framecount,framedelay; 41 42}SPRITE; 43 44void updatesprite(SPRITE *spr) 45{ 46 47 spr->x += 5; 48 if(spr->x > SCREEN_W - spr->width) 49 spr->x = 100; 50 51 /* 52 //update x position 53 if (++spr->xcount > spr->xdelay) 54 { 55 spr->xcount = 0; 56 spr->x += spr->xspeed; 57 } 58 59 //update y position 60 if (++spr->ycount > spr->ydelay) 61 { 62 spr->ycount = 0; 63 spr->y += spr->yspeed; 64 } 65 66 //update frame based on animdir 67 if (++spr->framecount > spr->framedelay) 68 { 69 spr->framecount = 0; 70 if (spr->animdir == -1) 71 { 72 if (--spr->curframe < 0) 73 spr->curframe = spr->maxframe; 74 } 75 else if (spr->animdir == 1) 76 { 77 if (++spr->curframe > spr->maxframe) 78 spr->curframe = 0; 79 } 80 } 81} 82 83void bouncesprite(SPRITE *spr) 84{ 85 //simple screen bouncing behavior 86 if (spr->x < 0) 87 { 88 spr->x = 0; 89 spr->xspeed = rand() % 2 + 2; 90 spr->animdir *= -1; 91 } 92 93 else if (spr->x > SCREEN_W - spr->width) 94 { 95 spr->x = SCREEN_W - spr->width; 96 spr->xspeed = rand() % 2 - 4; 97 spr->animdir *= -1; 98 } 99 100 if (spr->y < 0) 101 { 102 spr->y = 0; 103 spr->yspeed = rand() % 2 + 2; 104 spr->animdir *= -1; 105 } 106 107 else if (spr->y > SCREEN_H - spr->height) 108 { 109 spr->y = SCREEN_H - spr->height; 110 spr->yspeed = rand() % 2 - 4; 111 spr->animdir *= -1; 112 } 113 114} 115 116void drawframe(BITMAP *source, BITMAP *dest, 117 int x, int y, int width, int height, 118 int startx, int starty, int columns, int frame) 119{ 120 //calculate frame position 121 int framex = startx + (frame % columns) * width; 122 int framey = starty + (frame / columns) * height; 123 //draw frame to destination bitmap 124 masked_blit(source,dest,framex,framey,x,y,width,height); 125} 126*/ 127int main(void) 128{ 129 //images and sprites 130 BITMAP *buffer; 131 BITMAP *bg; 132 //SPRITE theball; 133 //SPRITE *ball = &theball; 134 BITMAP *ballimage; 135 BITMAP *ryu[6]; 136 int x = 10, y =200; 137 int x2 = 100, n; 138 char s[20]; 139 int curframe=0, framedelay=5, framecount=0; 140 //initialize 141 allegro_init(); 142 set_color_depth(16); 143 set_gfx_mode(MODE, WIDTH, HEIGHT, 0, 0); 144 install_keyboard(); 145 install_timer(); 146 srand(time(NULL)); 147 register_png_file_type(); //atya:untuk menghandle gambar tipe png 148 //create the back buffer 149 buffer = create_bitmap(WIDTH,HEIGHT); 150 151 //load background 152 bg = load_bitmap("bluespace.bmp", NULL); 153 if (!bg) { 154 allegro_message("Error loading background image\n%s", allegro_error); 155 return 1; 156 } 157 158 //lock interrupt variables 159 LOCK_VARIABLE(counter); 160 LOCK_VARIABLE(framerate); 161 LOCK_VARIABLE(ticks); 162 LOCK_VARIABLE(resting); 163 LOCK_VARIABLE(rested); 164 LOCK_FUNCTION(timer1); 165 LOCK_FUNCTION(rest1); 166 install_int(timer1, 1000); 167 168 //load 32-frame tiled sprite image 169 ballimage = load_png("super-fireball06.png", NULL); 170 if (!ballimage) { 171 allegro_message("Error loading ball image\n%s", allegro_error); 172 return 1; 173 } 174 //load the animated sprite 175 for(n=0; n<6; n++){ 176 sprintf(s, "ryu-haddoken0%d.png", n+1); 177 ryu[n] = load_png(s, NULL); 178 } 179 //randomize the sprite 180 //ball->x = SCREEN_W ; 181 // ball->y = SCREEN_H / 2; 182 // ball->width = 82; 183 //ball->height = 43; 184 //ball->xdelay = rand() % 2 + 1; 185 //ball->ydelay = rand() % 2 + 1; 186 //ball->xcount = 0; 187 //ball->ycount = 0; 188 //ball->xspeed = rand() % 2 + 2; 189 //ball->yspeed = rand() % 2 + 2; 190 //ball->curframe = 0; 191 //ball->maxframe = 1; 192 //ball->framecount = 0; 193 //ball->framedelay = 1; 194 // ball->animdir = 1; 195 196 //game loop 197 while (!key[KEY_ESC]) 198 { 199 //fill screen with background image 200 blit(bg, buffer, 0, 0, 0, 0, WIDTH, HEIGHT); 201 202 //update ticks 203 ticks++; 204 205 //slow the game down 206 resting=0; 207 rest_callback(8, rest1); 208 209 //display framerate 210 textprintf_centre_ex(buffer,font,320,330,WHITE,-1,"COUNTER %d", counter); 211 textprintf_centre_ex(buffer,font,320,340,WHITE,-1,"FRAMERATE %d", framerate); 212 textprintf_centre_ex(buffer,font,320,350,WHITE,-1,"RESTING %d", rested); 213 214 //update the position ball 215 x2 += 5; 216 if(x2 > SCREEN_W - 43) 217 x2 = 100; 218 219 //update the frame for lot picture 220 /*if(framecount++ > framedelay){ 221 framecount = 0; 222 curframe++; 223 if(curframe > 4) 224 curframe = 0; 225 }*/ 226 227 228 229 masked_blit(ballimage, buffer, 0, 0, x2, y, 82, 43); 230 masked_blit(ryu[0], buffer, 0, 0, x, y, 116, 101); 231 //display some info 232 textout_ex(buffer, font, "DrawFrame Program (ESC to quit)", 233 0, 0, WHITE, 0); 234 235 if(key[KEY_S]){ 236 int i=0; 237 for(i; i<5; i++){ 238 curframe++; 239 if(curframe>4) 240 curframe = 0; 241 masked_blit(ryu[curframe], buffer, 0, 0, x, y, 116, 101); 242 243 } 244 245 } 246 //refresh the screen 247 acquire_screen(); 248 blit(buffer, screen, 0, 0, 0, 0, WIDTH, HEIGHT); 249 release_screen(); 250 rest(10); 251 } 252 253 destroy_bitmap(ballimage); 254 destroy_bitmap(bg); 255 destroy_bitmap(buffer); 256 for(int i=0; i<6; i++) 257 destroy_bitmap(ryu[i]); 258 allegro_exit(); 259 return 0; 260} 261END_OF_MAIN()

--------------------------
i have that code and has attach the image..i using png picture..i want ask..if i press s, i want ryu release his hadoken with 5 frame but it seem i can do that animation sprite.. can anybody help me???? thanx

LennyLen
Member #5,313
December 2004
avatar

Quote:

can anybody help me????

Try putting the code in <src></src> code first, so it's readable at least.

p.s.

Quote:

i have that code and has attach the image..i using png picture..i want ask..if i press s, i want ryu release his hadoken with 5 frame but it seem i can do that animation sprite..

What??? Please, if you can't speak English, try to get someone who can to write for you.

badboy1986
Member #11,958
May 2010

i had attach the source code and the picture in attachments...i want to make animation regarding the Street Fighter "ryu character"..can u help me to make ryu can release his "HADOKEN"??;D

Thomas Fjellstrom
Member #476
June 2000
avatar

Please edit your post and wrap the code in <code></code> tags. Please.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Kthanid
Member #12,218
August 2010
avatar

I think you have a number of other things to worry about before you need to start trying to work with animations. I'd start with the following:

1) Clean up your code. Half of what you posted is already commented out, the rest is a mix of example code mashed together with your own modifications.

2) Understand the basic concepts of the main loop and timers to control a reasonable refresh rate.

3) Understand the concept of blitting images. In your case you are looping through a for loop entirely when a key is pressed (and anytime the time the key is held down) and blitting all frames to the same location on your buffer bitmap.

I know you're excited to get ahead of yourself, but I'd start with the following challenge first:

Get a main loop running at 60fps, draw a single static image to the screen, and control the location of that image with keyboard inputs (while properly using timers to control how fast the static image can move).

Just my two cents.

badboy1986
Member #11,958
May 2010

the code with commented out is for the demo..but i not using that commented out code..
i confuse how to make "ryu" release his "hadoken" with press s..can u give a hint about that animation..

Kthanid
Member #12,218
August 2010
avatar

the code with commented out is for the demo..but i not using that commented out code..

I'm pretty sure that goes without saying.

badboy1986 said:

i confuse how to make "ryu" release his "hadoken" with press s..can u give a hint about that animation..

Yes, I can give you a hint, but since you're already disregarding the other hints I just gave I'm not sure how much value it will have. That being said, here's the hint:

Ideally for animation to be visible to the user in any meaningful way you're going to want to display each frame of animation on the screen for a "long enough" period of time for the user to actually see those frames. Hint: You're clearing your buffer to the bg bitmap on every pass through your main loop.

EDIT - For the record, I'm not saying you shouldn't clear your buffer on every pass (you should), you just need to be sure you're also drawing the correct frame of animation (i.e. the "active" frame) on any given single pass through the loop.

badboy1986
Member #11,958
May 2010

#SelectExpand
1 2#include <stdio.h> 3#include <allegro.h> 4#include "loadpng.h" 5 6 7#define MODE GFX_AUTODETECT_WINDOWED 8#define WIDTH 800 9#define HEIGHT 600 10#define WHITE makecol(255,255,255) 11 12//timer variables 13volatile int counter; 14volatile int ticks; 15volatile int framerate; 16volatile int resting, rested; 17 18//calculate framerate every second 19void timer1(void){ 20 counter++; 21 framerate = ticks; 22 ticks=0; 23 rested = resting; 24} 25END_OF_FUNCTION(timer1) 26 27//do something while resting (?) 28void rest1(void){ 29 resting++; 30} 31 32 33int main(void) 34{ 35 //images and sprites 36 BITMAP *buffer; 37 BITMAP *bg; 38 39 BITMAP *ballimage; 40 BITMAP *ryu[6]; 41 int x = 10, y =200; 42 int x2 = 100, n; 43 char s[20]; 44 int curframe=0, framedelay=5, framecount=0; 45 //initialize 46 allegro_init(); 47 set_color_depth(16); 48 set_gfx_mode(MODE, WIDTH, HEIGHT, 0, 0); 49 install_keyboard(); 50 install_timer(); 51 srand(time(NULL)); 52 register_png_file_type(); //atya:untuk menghandle gambar tipe png 53 //create the back buffer 54 buffer = create_bitmap(WIDTH,HEIGHT); 55 56 //load background 57 bg = load_bitmap("bluespace.bmp", NULL); 58 if (!bg) { 59 allegro_message("Error loading background image\n%s", allegro_error); 60 return 1; 61 } 62 63 //lock interrupt variables 64 LOCK_VARIABLE(counter); 65 LOCK_VARIABLE(framerate); 66 LOCK_VARIABLE(ticks); 67 LOCK_VARIABLE(resting); 68 LOCK_VARIABLE(rested); 69 LOCK_FUNCTION(timer1); 70 LOCK_FUNCTION(rest1); 71 install_int(timer1, 1000); 72 73 //load 32-frame tiled sprite image 74 ballimage = load_png("super-fireball06.png", NULL); 75 if (!ballimage) { 76 allegro_message("Error loading ball image\n%s", allegro_error); 77 return 1; 78 } 79 //load the animated sprite 80 for(n=0; n<6; n++){ 81 sprintf(s, "ryu-haddoken0%d.png", n+1); 82 ryu[n] = load_png(s, NULL); 83 } 84 85 86 //game loop 87 while (!key[KEY_ESC]) 88 { 89 //fill screen with background image 90 blit(bg, buffer, 0, 0, 0, 0, WIDTH, HEIGHT); 91 92 //update ticks 93 ticks++; 94 95 //slow the game down 96 resting=0; 97 rest_callback(8, rest1); 98 99 //display framerate 100 textprintf_centre_ex(buffer,font,320,330,WHITE,-1,"COUNTER %d", counter); 101 textprintf_centre_ex(buffer,font,320,340,WHITE,-1,"FRAMERATE %d", framerate); 102 textprintf_centre_ex(buffer,font,320,350,WHITE,-1,"RESTING %d", rested); 103 104 //update the position ball 105 x2 += 5; 106 if(x2 > SCREEN_W - 43) 107 x2 = 100; 108 109 //update the frame for lot picture 110 if(framecount++ > framedelay){ 111 framecount = 0; 112 curframe++; 113 if(curframe > 4) 114 curframe = 0; 115 } 116 117 118 119 masked_blit(ballimage, buffer, 0, 0, x2, y, 82, 43); 120 masked_blit(ryu[0], buffer, 0, 0, x, y, 116, 101); 121 //display some info 122 textout_ex(buffer, font, "DrawFrame Program (ESC to quit)", 123 0, 0, WHITE, 0); 124 125 if(key[KEY_S]){ 126 127 masked_blit(ryu[curframe], buffer, 0, 0, x, y, 116, 101); 128 129 } 130 //refresh the screen 131 acquire_screen(); 132 blit(buffer, screen, 0, 0, 0, 0, WIDTH, HEIGHT); 133 release_screen(); 134 rest(10); 135 } 136 137 destroy_bitmap(ballimage); 138 destroy_bitmap(bg); 139 destroy_bitmap(buffer); 140 for(int i=0; i<6; i++) 141 destroy_bitmap(ryu[i]); 142 allegro_exit(); 143 return 0; 144} 145END_OF_MAIN()

--------------------------------------------------------
i already clean my code to this new version..but i'm still confuse..
can u give me some example on that frame animation??

Kthanid
Member #12,218
August 2010
avatar

Step through your main loop one statement at a time. Pretend you are the computer and process these statements in sequential order and THINK about what is actually happening. Compare this to what you want to happen.

After you do that, answer the following questions (and really, truly, think about the answers, be concise and accurate):

1) What frame of Ryu's animation do you want to be displayed by default (when nothing else is happening)?

2) Once the "S" key is pressed, how long should each frame of animation be displayed on the screen?

3) At what frame during the animation should the ball appear or, alternatively, how long after the animation begins should the ball appear?

4) Where should the ball be positioned when it comes into existence?

5) What direction should the ball travel?

6) How fast should the ball move?

7) How far should the ball move?

8) What should happen to Ryu after he finishes his animation cycle? Should it repeat indefinitely? Should it return to the default frame?

9) What should happen to the ball when it reaches it's ultimate destination?

10) Is it possible for Ryu to throw more than one ball at a time?

11) How long after a ball has been thrown can another one be thrown?

There are other questions you should be asking as well, but lets start by gathering the answers to these.

EDIT - In case it isn't obvious, I'm trying to "teach you to fish" here. Just giving you the answer isn't going to do either one of us any good. Also, you should really consider the advice I already gave you and start with something simpler.

bamccaig
Member #7,536
July 2006
avatar

If you want my advice, separate the animation into a separate file. Start with a structure to store it and write some simple functions that operate on it (and never access the structure's members directly). It's very hard to make code work when you're doing too much at once, even for a veteran. There is just too much to keep track of. By separating the code into smaller parts (modules or functions) you can focus on smaller parts at a time and get those working instead. It's a LOT easier than trying to get one big long sequential program working.

An animation has a few basic components: a set of sequential images, a frame rate, and some indication of time. I just wrote up this example:

animation.h#SelectExpand
1#ifndef ANIMATION_H 2 #define ANIMATION_H 3 4 #include <allegro.h> 5 #include <assert.h> 6 #include <loadpng.h> 7 #include <stdarg.h> 8 #include <stdio.h> 9 #include <stdlib.h> 10 11enum animation_type_t 12{ 13 ANIMATION_TYPE_BMP, 14 ANIMATION_TYPE_PNG 15}; 16 17typedef enum animation_type_t animation_type_t; 18 19struct animation_t 20{ 21 animation_type_t type_; 22 int num_frames_; 23 int start_ticks_; 24 int ticks_per_frame_; 25 BITMAP ** frames_; 26}; 27 28typedef struct animation_t animation_t; 29 30animation_t * animation_create(animation_type_t, int, int, ...); 31animation_t * animation_createa(animation_type_t, int, int, char * []); 32animation_t * animation_createf(animation_type_t, int, int, const char *); 33animation_t * animation_createv(animation_type_t, int, int, va_list); 34void animation_destroy(animation_t **); 35BITMAP * animation_begin(animation_t * a, int ticks); 36BITMAP * animation_frame(animation_t * a, int ticks); 37 38#endif

animation.c#SelectExpand
1#include "animation.h" 2 3animation_t * animation_create( 4 animation_type_t type, 5 int ticks_per_frame, 6 int num_frames, 7 ...) 8{ 9 va_list ap; 10 11 va_start(ap, num_frames); 12 13 animation_t * a = animation_createv( 14 type, 15 ticks_per_frame, 16 num_frames, 17 ap); 18 19 va_end(ap); 20 21 return a; 22} 23 24animation_t * animation_createa( 25 animation_type_t type, 26 int ticks_per_frame, 27 int num_frames, 28 char * filenames[]) 29{ 30 assert(filenames); 31 32 int i = -1; 33 BITMAP ** frames = 0; 34 BITMAP * (*load)(const char *, RGB * pal); 35 36 switch(type) 37 { 38 case ANIMATION_TYPE_BMP: 39 load = load_bitmap; 40 break; 41 case ANIMATION_TYPE_PNG: 42 load = load_png; 43 break; 44 default: 45 return 0; 46 } 47 48 animation_t * a = malloc(sizeof(animation_t)); 49 50 if(!a) 51 return 0; 52 53 frames = malloc(sizeof(BITMAP *) * num_frames); 54 55 if(!frames) 56 goto error; 57 58 for(i=0; i<num_frames; i++) 59 { 60 char * filename = filenames[i]; 61 62 assert(filename); 63 64 frames[i] = load(filename, 0); 65 66 if(!frames[i]) 67 { 68 i--; 69 goto error; 70 } 71 } 72 73 a->frames_ = frames; 74 a->start_ticks_ = 0; 75 a->num_frames_ = num_frames; 76 a->ticks_per_frame_ = ticks_per_frame; 77 a->type_ = type; 78 79 return a; 80 81error: 82 for(; i>=0; i--) 83 destroy_bitmap(frames[i]); 84 85 free(frames); 86 87 free(a); 88} 89 90animation_t * animation_createf( 91 animation_type_t type, 92 int ticks_per_frame, 93 int num_frames, 94 const char * filename_format) 95{ 96 animation_t * a = 0; 97 char buf[1025]; 98 char ** filenames = 0; 99 int i = -1; 100 int maxlen = strlen(filename_format) * 2; 101 102 assert(filename_format); 103 104 filenames = malloc(sizeof(char *) * num_frames); 105 106 if(!filenames) 107 return 0; 108 109 for(i=0; i<num_frames; i++) 110 { 111 char * filename; 112 int len; 113 114 filename = malloc(sizeof(char) * maxlen); 115 116 if(!filename) 117 { 118 i--; 119 goto cleanup; 120 } 121 122 len = snprintf(filename, 1024, filename_format, i + 1); 123 124 filename[len] = 0; 125 126 filenames[i] = filename; 127 } 128 129 i--; 130 131 a = animation_createa( 132 type, 133 ticks_per_frame, 134 num_frames, 135 filenames); 136 137cleanup: 138 for(; i>=0; i--) 139 free(filenames[i]); 140 141 free(filenames); 142 143 return a; 144} 145 146animation_t * animation_createv( 147 animation_type_t type, 148 int ticks_per_frame, 149 int num_frames, 150 va_list ap) 151{ 152 int i; 153 154 char ** filenames = malloc(sizeof(char *) * num_frames); 155 156 if(!filenames) 157 return 0; 158 159 for(i=0; i<num_frames; i++) 160 filenames[i] = va_arg(ap, char *); 161 162 animation_t * a = animation_createa( 163 type, 164 ticks_per_frame, 165 num_frames, 166 filenames); 167 168 free(filenames); 169 170 return a; 171} 172 173void animation_destroy(animation_t ** p_a) 174{ 175 int i; 176 177 assert(p_a); 178 179 animation_t * a = *p_a; 180 181 if(a) 182 { 183 for(i=0; i<a->num_frames_; i++) 184 destroy_bitmap(a->frames_[i]); 185 186 free(a->frames_); 187 free(a); 188 *p_a = a; 189 } 190} 191 192BITMAP * animation_begin(animation_t * a, int ticks) 193{ 194 assert(a); 195 196 a->start_ticks_ = ticks; 197 198 return animation_frame(a, ticks); 199} 200 201BITMAP * animation_frame(animation_t * a, int ticks) 202{ 203 assert(a); 204 assert(ticks >= a->start_ticks_); 205 206 int past = (ticks - a->start_ticks_) / a->ticks_per_frame_; 207 int current_frame_ = past % (a->num_frames_ - 1); 208 209 return a->frames_[current_frame_]; 210}

Then, to create your animation object, you do something like this:

animation_t * haddokken = animation_createf(
        ANIMATION_TYPE_PNG,
        10,
        5,
        "ryu-haddoken%02d.png");

if(!haddokken)
{
    allegro_message("Failed to create haddokken animation. Aborting...");
    exit(1);
}

To start it, you do something like this:

animation_begin(haddokken, total_ticks);

And to draw it, you do something like this:

BITMAP * haddokken_frame = animation_frame(haddokken, total_ticks);

blit(
        haddokken_frame,
        screen,
        0,
        0,
        100,
        100,
        haddokken_frame->w,
        haddokken_frame->h);

Finally, when you're done with it, you destroy it, just like you do with Allegro's BITMAPs.

animation_destroy(&haddokken);

There's a running example attached. It uses the images that you attached to your OP so make sure those are in the current working directory when running it. It was made in Linux so if you're working in Windows then you may need some tweaking to make it build. Also, src/main.c was hacked up from the timer examples on the Allegro wiki so don't necessarily consider its code best practice. :P

badboy1986
Member #11,958
May 2010

can u give more simple sample that can i understand because i'm still new..

Tobias Dammers
Member #2,604
August 2002
avatar

The example he gave is about as simple as it gets. If that's too complicated for you, then the project is WAY over your head as it stands.

Nonetheless, here's another approach.

Make a little proof-of-concept application that does nothing except set up a graphics mode, and loop a sprite animation repeatedly until you press a key. Hardcode everything at first, then see where you can generalize. Rinse & repeat until you have a flexible piece of code that you could copy into your game (with a few modifications here and there). Starting with a prototype for a new feature often helps you focus on the main thing and disregard other concerns until they arise, IOW, I make the functionality first, and then I worry about how it fits into the greater scheme of things.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Daniel McKinnon
Member #7,364
June 2006

Badboy1986, good job on getting this far. As to why you can't get solid examples, I may have some insight.

First, it's more important you understand HOW the code works. If you are relatively experienced programmer you should be able to take just about any set of steps and translate it into code. The people here are trying to encourage you to learn the fundamentals so they can better assist you.

Also, I've noticed many developers from India and places with low wages like that use a strange tactic to get their work done. What they do is accept a contract they are unsure about technically, but very sure about legally, then go onto forums asking for people to complete the code for them for free by looking for 'examples'.

Some people have been burned by this behavior and are reluctant to post a direct example.

Cheers.

bamccaig
Member #7,536
July 2006
avatar

badboy1986
Member #11,958
May 2010

i have compile your code in windows..but it has debug error that i cannot know.. :( :-[ .. but i cannot undestand it because of my inexperienced.. but anyway..i tried again..or i find a example..

bamccaig
Member #7,536
July 2006
avatar

Are you using an IDE or directly using a compiler? Microsoft Visual C++, Code::Blocks + MinGW, Dev-C++ + MinGW, or something else?

badboy1986
Member #11,958
May 2010

i'm using microsoft visual studio 2005(vc8)..
but it seem has debug error.. in file output.c (C:\Program Files\Microsoft Visual Studio 8\VC\crt\src\output.c). can u help me to fix your code that use in windows in msv 2005..

in my code, why if i loop it using while.."ryu can smooth animate" but if i place it in KEY_S it cannot work unless i always press s??
how can i reverse,if i press S it make smooth animate ryu sprite??

Go to: