1 / 14

sprites

sprites. 곽용식. DS Sprite Specs. 한 Screen 에 128 개의 스프라이트 사용가능 (2*128 = 총 257 개의 스프라이트 가능 ) 사용기능 수직 , 수평변환 애니메이션 Screen 상에서의 이동 부분적인 투명색 mosaic 회전 ( 스크린당 32 개의 스프라이트만 가능 )/ 축소 / 확대. DS Screen Sizes. Color Modes. 16 Color: 16 색의 팔레트를 사용

reina
Télécharger la présentation

sprites

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. sprites 곽용식

  2. DS Sprite Specs • 한 Screen에 128개의 스프라이트 사용가능(2*128 = 총 257개의 스프라이트 가능) • 사용기능 • 수직,수평변환 • 애니메이션 • Screen상에서의 이동 • 부분적인 투명색 • mosaic • 회전(스크린당 32개의 스프라이트만 가능)/축소/확대

  3. DS Screen Sizes

  4. Color Modes • 16 Color: 16색의 팔레트를 사용 • 256 Color: 256색의 팔레트를 사용, 자주 사용됨 • 16Bit Color : 256에 비해 많은 공간을 필요로함 • 주로 사용되는 것은 256 Color 스프라이트

  5. Sprite Sizes

  6. Transparent color • 스프라이트의 배경을 투명하게 만들 때 사용, 지정된 색은 화면상에서 보여지지 않는다. • 공통적으로 주로 사용되는 투명색 : • Magenta | 255,0,255 • “Blackread” | 1,0,0 • Off Black | 1,1,1 • Off white | 254,254,254

  7. PAlib Sprites PA_LoadSpritePal(0, // 스크린번호 0, // Palette number (void*)sprite0_Pal); // Palette name PA_CreateSprite( 0, // 스크린번호 0, // 스프라이트번호 (void*)vaisseau_Sprite, // 스프라이트이름 OBJ_SIZE_32X32, // 스프라이트크기 1, // 256 color mode 0, // 사용할 팔레트번호 50, 50); // X and Y position on the screen

  8. PAlib Spritesmove PA_MoveSprite(i); PA_SetSpriteXY(screen, sprite, x, y);

  9. move X and Y limits X: 0~511 Y:0~255 x += Pad.Held.Right - Pad.Held.Left; y += Pad.Held.Down - Pad.Held.Up; x += Pad.Held.Right - Pad.Held.Left; => x += 1 - 0 빠른 키입력을 고려하여 스피드 설정 x += (Pad.Held.Right - Pad.Held.Left) * speed; y += (Pad.Held.Down - Pad.Held.Up) * speed; Stylus:터치 위치 PA_SetSpriteXY(0,0,Stylus.X,Stylus.Y);

  10. PAlib Spritesrotation PA_SetSpriteRotEnable( 0,// 스크린번호 0,// 스프라이트번호 0);// 회전체 번호 (0~31) 확대축소도 같은 방법 ++angle; // 변환될 회전각도 angle &= 511; // 0-511의 값. 사용되는 값은 1, 3, 7, 15, 31등 (2^n - 1) // 빠른 회전을 위해 확대/축소를 뺀 함수 PA_SetRotsetNoZoom( 0, //스크린번호 0, // 회전체번호 angle); // 변환될 회전각도 (0 ~ 511)

  11. PAlib Spriteszoom u16 zoom = 256 ; zoom -= Pad.Held.Up - Pad.Held.Down PA_SetRotsetNoAngle( 0, //screen 0, // rotset zoom, zoom); Zoom의 크기 -256 : 원래 크기 - 512 : 50% 크기 - 128 : 200%크기

  12. PAlib SpritesSprite Flipping 한가지 스프라이트로 여러 스프라이트 출력가능 PA_SetSpriteHflip( screen, sprite, 1/0 for yes/no) 수평전환 (왼쪽/오른쪽) PA_SetSpriteVflip( screen, sprite, 1/0 for yes/no), 수직전환 (위/아래)

  13. PAlib SpritesAnimations PA_LoadSpritePal(0, // Screen 0, // Palette number (void*)explosion_Pal); // 다른 속도로 애니메이션되는걸 보여주기 위해 여러개의스프라이트 생성 PA_CreateSprite(0, 0,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 0, 64); PA_CreateSprite(0, 1,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 64, 64); PA_CreateSprite(0, 2,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 128, 64); PA_CreateSprite(0, 3,(void*)explosion_Sprite, OBJ_SIZE_64X64,1, 0, 196, 64); // 애니메이션 실행 PA_StartSpriteAnim(0, // screen 0, // sprite number 0, // 시작프레임 6, // 마지막 프레임 6 *7개의 프레임을 가지고 있을때 5); // 5fps PA_StartSpriteAnim(0, 1, 0, 6, 15); // 15 fps로 애니메이션 PA_StartSpriteAnim(0, 2, 0, 6, 30); // 30 fps로 애니메이션 PA_StartSpriteAnim(0, 3, 0, 6, 60); // 60 fps로 애니메이션

  14. PAlib SpritesAnimations if(Pad.Newpress.Up) PA_StartSpriteAnim(0, 0, 0, 3, 6); if(Pad.Newpress.Down) PA_StartSpriteAnim(0, 0, 8, 11, 6); /* 좌우 전환*/ if(Pad.Newpress.Right) { PA_StartSpriteAnim(0, 0, 4, 7, 6); PA_SetSpriteHflip(0, 0, 0); } if(Pad.Newpress.Left) { PA_StartSpriteAnim(0, 0, 4, 7, 6); PA_SetSpriteHflip(0, 0, 1); }

More Related