Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @DrawLoop {
- SetTexture(boss); //tells Danmakufu what image to use
- SetRenderState(ALPHA); //how the image is rendered, this shouldn't need to be explained
- SetAlpha(255); //how transparent the image is
- SetGraphicScale(1,1); //the scale of the image, in this case the default
- SetGraphicAngle(0,0,0); //the angle the image is drawn at, in this case the default
- if(int(GetSpeedX())==0){ //checks if the horizontal speed of the boss is lower than 1 pixel/second. if this is true, the block of code inside is executed
- if(f<10){ SetGraphicRect(0,0,64,64); } //if less than ten frames have passed, the contents of the image will be at the coordinates (0,0,64,64)
- if(f>=10 && f<20){ SetGraphicRect(64,0,128,64); } //if less than twenty and more than or equal to ten frames have passed, image contents will be between (64,0,128,64)
- if(f>=20 && f<30){ SetGraphicRect(128,0,192,64); } etc.
- if(f>=30 && f<40){ SetGraphicRect(192,0,256,64); }
- f2=0; //the counter for movement is reset here.
- }
- if(GetSpeedX()>0){ //checks if the horizontal speed is bigger than zero (positive). (Moving to the right) if this is true, the code inside is executed
- if(f2<5){ SetGraphicRect(0,64,64,128); } //the same as above
- if(f2>=5 && f2<10){ SetGraphicRect(64,64,128,128); }
- if(f2>=10 && f2<15){ SetGraphicRect(128,64,192,128); }
- if(f2>=15){ SetGraphicRect(192,64,256,128); }
- f2++; //increases the counter for movement, so that the contents of the drawn image will change, and the animation will play
- }
- if(GetSpeedX()<0){ //checks if the horizontal speed is smaller than zero (negative).(Moving to the left) if this is true, the code inside is executed
- SetGraphicAngle(180,0,0); //mirrors the image
- if(f2<5){ SetGraphicRect(0,64,64,128); } //this code is the same as in the block of code for moving to the right
- if(f2>=5 && f2<10){ SetGraphicRect(64,64,128,128); }
- if(f2>=10 && f2<15){ SetGraphicRect(128,64,192,128); }
- if(f2>=15){ SetGraphicRect(192,64,256,128); }
- f2++;
- }
- DrawGraphic(GetX,GetY); //draws the graphic
- f++; //increases the counter for the default (idle) animation, so that the animation will play
- if(f==40){f=0;} //if the counter for the default animation becomes too big, it is reset
- }
Advertisement
Add Comment
Please, Sign In to add comment