Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //script for Orb "enemy"
- script_enemy_main {
- let arg=GetArgument;
- let CSD = GetCurrentScriptDirectory;
- let img1=CSD ~ "green_orb.png";
- let img2=CSD ~ "red_orb.png";
- task MainTask{
- loop{
- SetAngle(rand_int(-15,15));
- wait(20);
- yield;
- }
- }
- @Initialize{
- LoadGraphic(img1);
- LoadGraphic(img2);
- SetLife(10);
- MainTask;
- }
- @MainLoop{
- SetCollisionA(GetX, GetY, 24);
- SetCollisionB(GetX, GetY, 24);
- yield;
- }
- @DrawLoop {
- if(arg==1){SetTexture(img1);} // 1 stands for green orb
- else{SetTexture(img2);} // 2 (or any other) stands for red
- SetGraphicRect(0,0,48,48);
- SetGraphicScale(0.5,0.5);
- DrawGraphic(GetX,GetY);
- }
- @Finalize {
- if(arg==1){CreateItem(ITEM_SCORE,GetX,GetY);}
- }
- function wait(w) {
- loop(w){yield;}
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment