Guest User

Thingamajig

a guest
Jun 23rd, 2020
49
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. task renderPlayer {
  2.     ObjPrim_SetTexture(playerObj, playerSprite);
  3.     Obj_SetRenderPriorityI(playerObj, 31);
  4.     ObjRender_SetBlendType(playerObj, BLEND_ALPHA);
  5.     ObjRender_SetAngleXYZ(playerObj, 0, 0, 0);
  6.     ObjRender_SetScaleXYZ(playerObj, 1, 1, 0);
  7.     ObjRender_SetAlpha(playerObj, 225);
  8.     ObjSprite2D_SetSourceRect(playerObj, 0, 0, 32, 48);
  9.     ObjSprite2D_SetDestCenter(playerObj);
  10.     ObjRender_SetPosition(playerObj, GetPlayerX, GetPlayerY, 0);
  11.    
  12.     while(!Obj_IsDeleted(playerObj)) {
  13.         ObjRender_SetPosition(playerObj, GetPlayerX, GetPlayerY, 0);
  14.         let animFrame = 0;
  15.         let animFrame2 = 0;
  16.        
  17.         //left
  18.         if(GetVirtualKeyState(VK_LEFT) == KEY_PUSH || GetVirtualKeyState(VK_LEFT) == KEY_HOLD) {
  19.             ObjRender_SetAngleY(playerObj, 0);
  20.             if(animFrame2 < 8) { ObjSprite2D_SetSourceRect(playerObj,0,48,32,96); }
  21.             if(animFrame2 >= 8 && animFrame2 < 15) { ObjSprite2D_SetSourceRect(playerObj,32,48,64,96); }
  22.             if(animFrame2 >= 15 && animFrame2 < 23) { ObjSprite2D_SetSourceRect(playerObj,64,48,96,96); }
  23.             if(animFrame2 >= 23 && animFrame2 < 30) { ObjSprite2D_SetSourceRect(playerObj,96,48,128,96); }
  24.             if(animFrame2 >= 30 && animFrame2 < 38) { ObjSprite2D_SetSourceRect(playerObj,128,48,160,96); }
  25.             if(animFrame2 >= 38 && animFrame2 < 45) { ObjSprite2D_SetSourceRect(playerObj,160,48,192,96); }
  26.             if(animFrame2 >= 45 && animFrame2 < 53) { ObjSprite2D_SetSourceRect(playerObj,192,48,224,96); }
  27.             if(animFrame2 >= 53) { ObjSprite2D_SetSourceRect(playerObj,224,48,256,86); }
  28.            
  29.         }
  30.        
  31.         //right
  32.         else if(GetVirtualKeyState(VK_RIGHT) == KEY_PUSH || GetVirtualKeyState(VK_RIGHT) == KEY_HOLD) {
  33.             ObjRender_SetAngleY(playerObj, 180);
  34.             if(animFrame2 < 8) { ObjSprite2D_SetSourceRect(playerObj,0,48,32,96); }
  35.             if(animFrame2 >= 8 && animFrame2 < 15) { ObjSprite2D_SetSourceRect(playerObj,32,48,64,96); }
  36.             if(animFrame2 >= 15 && animFrame2 < 23) { ObjSprite2D_SetSourceRect(playerObj,64,48,96,96); }
  37.             if(animFrame2 >= 23 && animFrame2 < 30) { ObjSprite2D_SetSourceRect(playerObj,96,48,128,96); }
  38.             if(animFrame2 >= 30 && animFrame2 < 38) { ObjSprite2D_SetSourceRect(playerObj,128,48,160,96); }
  39.             if(animFrame2 >= 38 && animFrame2 < 45) { ObjSprite2D_SetSourceRect(playerObj,160,48,192,96); }
  40.             if(animFrame2 >= 45 && animFrame2 < 53) { ObjSprite2D_SetSourceRect(playerObj,192,48,224,96); }
  41.             if(animFrame2 >= 53) { ObjSprite2D_SetSourceRect(playerObj,224,48,256,86); }
  42.         }
  43.        
  44.         //idle
  45.         else {
  46.             ObjRender_SetAngleY(playerObj, 0);
  47.             if(animFrame < 8) { ObjSprite2D_SetSourceRect(playerObj,0,0,32,48); }
  48.             if(animFrame >= 8 && animFrame < 15) { ObjSprite2D_SetSourceRect(playerObj,32,0,64,48); }
  49.             if(animFrame >= 15 && animFrame < 23) { ObjSprite2D_SetSourceRect(playerObj,64,0,96,48); }
  50.             if(animFrame >= 23 && animFrame < 30) { ObjSprite2D_SetSourceRect(playerObj,96,0,128,48); }
  51.             if(animFrame >= 30 && animFrame < 38) { ObjSprite2D_SetSourceRect(playerObj,128,0,160,48); }
  52.             if(animFrame >= 38 && animFrame < 45) { ObjSprite2D_SetSourceRect(playerObj,160,0,192,48); }
  53.             if(animFrame >= 45 && animFrame < 53) { ObjSprite2D_SetSourceRect(playerObj,192,0,224,48); }
  54.             if(animFrame >= 53) { ObjSprite2D_SetSourceRect(playerObj,224,0,256,48); }
  55.             animFrame2 = 0;
  56.         }
  57.        
  58.         animFrame++;
  59.         animFrame2+=2;
  60.         if(animFrame > 60) { animFrame = 0; }
  61.         ObjSprite2D_SetDestCenter(playerObj);
  62.         yield;
  63.     }
  64. }
RAW Paste Data