Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #TouhouDanmakufu[Single]
- #ScriptVersion[3] //This is required for ph3 scripts
- #Title["Border of cliche and beginner"]
- #Text["SampleA01:Shooting Bullets Straight Down"]
- #BGM ["./LLS - Alice Maestra.mp3"]
- //Danmakufu basic has dimensions 384 x 448
- //Load the default shotsheet
- #include"script/default_system/Default_ShotConst.txt"
- #incluce"script/default_system/Extra_ShotConst.txt"
- let objBoss; //Enemy object
- let objScene = GetEnemyBossSceneObjectID();
- //----------------------------------------------------
- //Enemy movement
- //----------------------------------------------------
- @Event
- {
- alternative(GetEventType())
- case(EV_REQUEST_LIFE){
- SetScriptResult(500); //Setting the enemy's life to 500
- }
- case(EV_REQUEST_TIMER){
- SetScriptResult(60); //Setting script timer to 60 seconds
- }
- case(EV_REQUEST_SPELL_SCORE){
- SetScriptResult(1000000); //Set spellcard score value
- }
- }
- @Initialize
- {
- //Creating and registering enemy objects
- objBoss = ObjEnemy_Create(OBJ_ENEMY_BOSS);
- ObjEnemy_Regist(objBoss);
- //Moving to the coordinate (centre of X axis, 60) in 60 frames
- ObjMove_SetDestAtFrame(objBoss, GetCenterX(), 60, 60);
- //Designate the beginning of a spellcard
- ObjEnemyBossScene_StartSpell(objScene);
- //Calling TCutIn to draw a cut in when the spell starts
- //TCutIn;
- //Calling TDrawLoop which draws enemy graphics
- TDrawLoop;
- //Calling TFinalize task which will end the spellcard
- TFinalize;
- //Calling MainTask task which will create bullets
- MainTask;
- }
- @MainLoop{
- //retrieving enemy coordinates
- let ex = ObjMove_GetX(objBoss);
- let ey = ObjMove_GetY(objBoss);
- //Setting the enemy hit box
- ObjEnemy_SetIntersectionCircleToShot(objBoss, ex, ey, 32); //hitbox against player bullets. 32 is the radius.
- ObjEnemy_SetIntersectionCircleToPlayer(objBoss, ex, ey, 0); //hitbox against the player. 24 is the radius.
- //Needed for task to work
- yield;
- }
- function GetCenterX(){
- return GetStgFrameWidth() / 2;
- }
- function GetCenterY(){
- return GetStgFrameHeight() / 2;
- }
- function wait(n) {
- loop(n) {yield;}
- }
- function rand_int(min, max){
- return truncate(rand(min, max+1))
- }
- task TFinalize {
- while(ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0) {yield;}
- Obj_Delete(objBoss);
- DeleteShotAll(TYPE_ALL, TYPE_ITEM);
- SetAutoDeleteObject(true);
- wait(30);
- CloseScript(GetOwnScriptID());
- if (ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SHOOTDOWN_COUNT)
- + ObjEnemyBossScene_GetInfo(objScene, INFO_PLAYER_SPELL_COUNT) == 0) {
- AddScore(ObjEnemyBossScene_GetInfo(objScene, INFO_SPELL_SCORE));
- }
- return;
- }
- //Creating MainTask. Will run and fire bullet if enemy life is > 0.
- task MainTask{
- BoWaP
- }
- task BoWaP{
- let angleT = rand(0, 360);
- let objcount = 0;
- while (ObjEnemy_GetInfo(objBoss, INFO_LIFE) > 0){
- CreateShotA1(102, 134, 3, angleT, 1, 5);
- CreateShotA1(282, 134, 3, angleT, 601, 5);
- angleT += sin(objcount) * 12; //BOWAP
- objcount += 1;
- yield;
- }
- }
- task TDrawLoop {
- let imgExRumia = GetCurrentScriptDirectory() ~ "/art/ExRumia.png"; //file path to enemy image
- ObjPrim_SetTexture(objBoss, imgExRumia);
- while(!Obj_IsDeleted(objBoss))
- {
- let angle = ObjMove_GetAngle(objBoss);
- let speed = ObjMove_GetSpeed(objBoss);
- if(speed == 0){ObjSprite2D_SetSourceRect(objBoss, 64, 1, 127, 64);}
- else if(cos(angle) > 0){ObjSprite2D_SetSourceRect(objBoss, 192, 1, 255, 64);}
- else if(cos(angle) < 0){ObjSprite2D_SetSourceRect(objBoss, 128 ,1, 191, 64);}
- ObjSprite2D_SetDestCenter(objBoss);
- yield;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement