Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void start_GW(SDL_Surface *screen,struct S_SPRITESHEET *S_sprite,SDL_Event event)
- {
- /* Load Background */
- if (GW_background == NULL) { GW_background = IMG_Load("Img/Screen1.png"); }
- SDL_BlitSurface(GW_background,NULL,SDL_GetVideoSurface(),NULL);
- /* Initial Position */
- S_sprite->link_src.x = 50;
- S_sprite->link_src.y = 0;
- S_sprite->link_src.h = 53;
- S_sprite->link_src.w = 39;
- S_sprite->link_dst.y = 70;
- /* Move Link */
- if(event.key.keysym.sym == SDLK_RIGHT) {
- if(x <= 190) { x += 20; }
- SDL_Delay(100);
- }
- if(event.key.keysym.sym == SDLK_LEFT) {
- if(x >= 55) { x -= 20; }
- }
- S_sprite->link_dst.x = x;
- if (S_sprite->link_dst.x == 200) {S_sprite->link_dst.x == 200; }
- SDL_BlitSurface(S_sprite->img,&S_sprite->link_src,SDL_GetVideoSurface(),&S_sprite->link_dst);
- /* Don't return to initial position */
- initial = 1;
- }
Add Comment
Please, Sign In to add comment