2023-01-26 11:34:56 +00:00
|
|
|
#TouhouDanmakufu[Player]
|
|
|
|
#ScriptVersion[3]
|
|
|
|
#ID["PL_NARUMI"]
|
|
|
|
#Title["Narumi Yatadera"]
|
|
|
|
#Text["Player 0"]
|
|
|
|
|
|
|
|
//#Image["./mariremi_lib/mariremi_illust.png"]
|
|
|
|
|
|
|
|
#ReplayName["Narumi"]
|
|
|
|
|
|
|
|
#include "script/KevinSystem/kevin_system/Lib_Const.dnh"
|
|
|
|
|
|
|
|
#include "script/KevinSystem/Kevin_PlayerLib.txt"
|
|
|
|
#include "script/KevinSystem/PlayerSoundLib.dnh"
|
|
|
|
|
|
|
|
#include "./Player_Function.dnh"
|
|
|
|
#include "./Player_ShotConst.dnh"
|
|
|
|
|
|
|
|
#include "script/KevinSystem/kevin_system/Kevin_ItemConst.txt"
|
|
|
|
#include "script/KevinSystem/kevin_system/Kevin_ItemLib.txt"
|
|
|
|
|
|
|
|
let csd = GetCurrentScriptDirectory();
|
|
|
|
|
|
|
|
// Global Variables
|
|
|
|
|
|
|
|
float maxX = GetStgFrameWidth();
|
|
|
|
float maxY = GetStgFrameHeight();
|
|
|
|
|
|
|
|
// Images & Sound
|
|
|
|
|
|
|
|
let teamimg = csd ~ "./playerlib/Player_Sheet.png";
|
|
|
|
LoadTextureEx(teamimg, true, true);
|
|
|
|
//ObjRender_SetTextureFilterMip(teamimg, FILTER_LINEAR);
|
|
|
|
|
|
|
|
let plimg = csd ~ "./playerlib/PlSheet_Narumi.png";
|
|
|
|
LoadTextureEx(plimg, true, true);
|
|
|
|
ObjRender_SetTextureFilter(plimg, FILTER_NONE, FILTER_NONE, FILTER_NONE);
|
|
|
|
|
|
|
|
let sndpath = csd ~ "./sound";
|
|
|
|
|
|
|
|
int[] _enemyArray = [];
|
|
|
|
int[] _existArray = [];
|
|
|
|
int[] _shotArray = [];
|
|
|
|
|
|
|
|
bool isChain = false;
|
|
|
|
bool isUseSpecialWpn = false;
|
|
|
|
float curChain = 0;
|
|
|
|
|
|
|
|
// Other stuff
|
|
|
|
|
|
|
|
float playerX = 0;
|
|
|
|
float playerY = 0;
|
|
|
|
|
|
|
|
let objPlayer = GetPlayerObjectID();
|
|
|
|
int plrender = 42;
|
|
|
|
|
|
|
|
bool ripplayer = false;
|
|
|
|
float shotspeed = 0;
|
|
|
|
float bombrand = 0;
|
|
|
|
|
|
|
|
int grazecounter = 0; // For basic graze = PIV mechanic
|
|
|
|
|
|
|
|
int shotAlpha = (GetAreaCommonData("Config", "PlayerShotOpacity", 255)*0.01)*255;
|
|
|
|
|
2023-01-31 11:05:02 +00:00
|
|
|
float shotDamageOption = 4.5;
|
2023-01-26 11:34:56 +00:00
|
|
|
float shotScaleOption = 1;
|
|
|
|
|
|
|
|
float shotDamageLaser = 2;
|
|
|
|
float shotScaleLaser = 1;
|
|
|
|
|
|
|
|
float shotDamageSpecial = 5;
|
|
|
|
float shotScaleSpecial = 1;
|
|
|
|
|
|
|
|
float[] PlayerSpd = [12, 6];
|
|
|
|
|
|
|
|
// Custom events for scoring mechanic
|
|
|
|
|
|
|
|
const EV_PIV_100 = EV_USER + 100i; // Normal enemies and nons
|
|
|
|
const EV_PIV_250 = EV_USER + 101i; // Spells
|
|
|
|
const EV_PIV_500 = EV_USER + 102i; // Last Spells
|
|
|
|
const EV_PIV_2000 = EV_USER + 103i; // What.
|
|
|
|
|
|
|
|
@Initialize{
|
|
|
|
|
|
|
|
if(!IsCommonDataAreaExists("PIV")){
|
|
|
|
CreateCommonDataArea("PIV");
|
|
|
|
SetAreaCommonData("PIV", "currentvalue", 10000);
|
|
|
|
SetAreaCommonData("PIV", "ChainAmount", 1);
|
|
|
|
}
|
|
|
|
else{}
|
|
|
|
|
|
|
|
SetPlayerStateEndEnable(true);
|
|
|
|
|
|
|
|
// Stuff
|
|
|
|
Parameter();
|
|
|
|
RenderPlayer();
|
|
|
|
BaseShot();
|
|
|
|
SpecialWeapon();
|
|
|
|
|
|
|
|
Obj_SetRenderPriorityI(objPlayer, 43);
|
|
|
|
plrender = Obj_GetRenderPriorityI(objPlayer);
|
|
|
|
_SoundTask();
|
|
|
|
|
|
|
|
//SetIntersectionVisualization(true); // Debug
|
|
|
|
|
|
|
|
_Mechanic(ripplayer, _enemyArray, _existArray, GetStgFrameWidth(), GetStgFrameHeight(), objPlayer, GetEnemyBossSceneObjectID(), 1, 2, 80);
|
|
|
|
|
|
|
|
_ShowChain();
|
|
|
|
//_HandleChainGauge();
|
|
|
|
|
|
|
|
//_HitboxRender(ripplayer, objPlayer, plimg, teamimg, 768, 192, 832, 256, 1536, 896, 2048, 1408, 0.5, 0.65);
|
|
|
|
SetShotAutoDeleteClip(96, 84, 96, 84);
|
|
|
|
|
|
|
|
_Countdown();
|
|
|
|
|
|
|
|
// Shot data loading
|
|
|
|
LoadPlayerShotData(csd ~ "./Player_ShotData.dnh");
|
|
|
|
}
|
|
|
|
|
|
|
|
@MainLoop{
|
|
|
|
_enemyArray = GetIntersectionRegistedEnemyID;
|
|
|
|
shotspeed += 1; // Managing the shot rate
|
|
|
|
//_shotArray = GetAllShotID(TARGET_PLAYER);
|
|
|
|
//UniversalAlphaHandle(_shotArray);
|
|
|
|
plrender = Obj_GetRenderPriorityI(objPlayer);
|
|
|
|
playerX = ObjMove_GetX(objPlayer);
|
|
|
|
playerY = ObjMove_GetY(objPlayer);
|
|
|
|
yield;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Event{
|
|
|
|
alternative(GetEventType)
|
|
|
|
|
|
|
|
// Delete effect
|
|
|
|
case(EV_DELETE_SHOT_PLAYER){
|
|
|
|
|
|
|
|
if(GetCommonDataPtr(EFFECTCUT_PTR, 0) >= 3){}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
let graphic = GetEventArgument(2);
|
|
|
|
float[] position = GetEventArgument(1);
|
|
|
|
|
|
|
|
let obj = CreatePlayerShotA1(position[0], position[1], 0, ObjMove_GetAngle(GetEventArgument(0))+rand(-15, 15), 0, 99999, graphic);
|
|
|
|
|
|
|
|
ObjShot_SetIntersectionEnable(obj, false);
|
|
|
|
_DeleteEffect(obj, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
//if(graphic == ELECTRIC_FIRE_ALT) {_DeleteEffectAlt(obj);}
|
|
|
|
//else{_DeleteEffect(obj);}
|
|
|
|
}
|
|
|
|
|
|
|
|
// PIV-item spawning events
|
|
|
|
case(EV_PIV_100){
|
|
|
|
let arg = GetEventArgument(0);
|
|
|
|
CreatePIVItem(PIV_100, arg[0], arg[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
case(EV_PIV_250){
|
|
|
|
let arg = GetEventArgument(0);
|
|
|
|
CreatePIVItem(PIV_250, arg[0], arg[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
case(EV_PIV_500){
|
|
|
|
let arg = GetEventArgument(0);
|
|
|
|
CreatePIVItem(PIV_500, arg[0], arg[1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Basic functionality events
|
|
|
|
case(EV_REQUEST_SPELL){
|
|
|
|
SetScriptResult(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
case(EV_HIT){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case(EV_CHAIN_MAX){
|
|
|
|
|
|
|
|
if(!isChain){
|
|
|
|
ObjSound_Play(Shine);
|
|
|
|
isChain = true;
|
|
|
|
curChain = GetCommonDataPtr(POINTER_CHAIN, 1);
|
|
|
|
}
|
|
|
|
else{}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case(EV_CHAIN_RELEASE){
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case(EV_CHAIN_END){
|
|
|
|
|
|
|
|
SetAreaCommonData("PIV", "ChainAmount", 1);
|
|
|
|
isChain = false;
|
|
|
|
|
|
|
|
// Increase rank depending on curChain (>= 32), then reset curChain. MAX CHAIN increases rank by 0.4.
|
|
|
|
|
|
|
|
if(curChain >= 32){
|
|
|
|
SetCommonData("Rank", clamp(GetCommonData("Rank", 1) + Interpolate_Linear(0.25, 0.5, curChain/64), GetCommonData("MinRank", 1), GetCommonData("MaxRank", 12)));
|
|
|
|
}
|
|
|
|
|
|
|
|
curChain = 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case(EV_PLAYER_SHOOTDOWN){
|
|
|
|
|
|
|
|
ObjSound_Play(PlayerDie2);
|
|
|
|
SetPlayerSpell(0);
|
|
|
|
ripplayer = true;
|
|
|
|
DeleteShotAll(TYPE_SHOT, TYPE_ITEM);
|
|
|
|
SetCommonData("Rank", clamp(GetCommonData("Rank", 1) * 0.75, GetCommonData("MinRank", 1), GetCommonData("MaxRank", 12)));
|
|
|
|
_DeathMove();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case(EV_PLAYER_REBIRTH){
|
|
|
|
ripplayer = false;
|
|
|
|
SetPlayerInvincibilityFrame(180);
|
|
|
|
//_Countdown();
|
|
|
|
_SigilCall(false, teamimg, 768+256, 512, 768+512, 768, objPlayer, 150);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
case(EV_GRAZE){
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Finalize{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Basic player parameters
|
|
|
|
|
|
|
|
task Parameter(){
|
|
|
|
|
|
|
|
// im trying to not be collected by the player but their item scope is dummy thicc and im alerted by its cheek
|
|
|
|
SetPlayerItemScope(360);
|
|
|
|
|
|
|
|
SetPlayerLife(9); // Debug
|
|
|
|
SetPlayerSpell(0);
|
|
|
|
SetPlayerSpeed(PlayerSpd[0], PlayerSpd[1]); // (original: 5.25/2.0)
|
|
|
|
SetPlayerRebirthFrame(0); // No bombs
|
|
|
|
SetPlayerDownStateFrame(90);
|
|
|
|
SetPlayerAutoItemCollectLine(GetStgFrameHeight/3);
|
|
|
|
SetPlayerRebirthLossFrame(0);
|
2023-01-31 11:05:02 +00:00
|
|
|
ObjPlayer_AddIntersectionCircleA1(objPlayer, 0, 0, 1, 40);
|
2023-01-26 11:34:56 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// Player render
|
|
|
|
|
|
|
|
task RenderPlayer(){
|
|
|
|
|
|
|
|
// Why is this movement code so cursed jesus fucking christ
|
|
|
|
|
|
|
|
float scale = 1; // Scalies
|
|
|
|
int frame = 0;
|
|
|
|
int spd = 12;
|
|
|
|
int frame_hbox = 0;
|
|
|
|
|
|
|
|
ObjPrim_SetTexture(objPlayer, plimg);
|
|
|
|
ObjSprite2D_SetSourceRect(objPlayer, 0, 0, 192, 192);
|
|
|
|
ObjSprite2D_SetDestCenter(objPlayer);
|
|
|
|
Obj_SetRenderPriorityI(objPlayer, plrender);
|
|
|
|
ObjRender_SetScaleXYZ(objPlayer, scale, scale, 1);
|
|
|
|
|
|
|
|
int hitbox = ObjPrim_Create(OBJ_SPRITE_2D);
|
|
|
|
|
|
|
|
ObjPrim_SetTexture(hitbox, plimg);
|
|
|
|
ObjSprite2D_SetSourceRect(hitbox, 384, 0, 448, 64);
|
|
|
|
ObjSprite2D_SetDestCenter(hitbox);
|
|
|
|
ObjRender_SetScaleXYZ(hitbox, scale, scale, 1);
|
|
|
|
ObjRender_SetBlendType(hitbox, BLEND_ALPHA);
|
|
|
|
Obj_SetRenderPriorityI(hitbox, 79);
|
|
|
|
|
|
|
|
Obj_SetVisible(hitbox, false);
|
|
|
|
|
|
|
|
// Lower "speed" parameter = FASTER SPEED
|
|
|
|
|
|
|
|
// FOR WHEN ONLY IDLE SPRITES ARE DONE
|
|
|
|
|
|
|
|
while(true){
|
|
|
|
|
|
|
|
frame++;
|
|
|
|
frame_hbox++;
|
|
|
|
|
|
|
|
ObjRender_SetPosition(hitbox, playerX, playerY, 1);
|
|
|
|
|
|
|
|
if(ripplayer){
|
|
|
|
ObjSprite2D_SetSourceRect(objPlayer, 0, 384, 192, 576);
|
|
|
|
Obj_SetVisible(hitbox, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
if(GetVirtualKeyState(VK_SLOWMOVE) != KEY_FREE){
|
|
|
|
|
|
|
|
ObjSprite2D_SetSourceRect(hitbox, 384+64*floor(frame_hbox/9), 0, 64+384+64*floor(frame_hbox/9), 64);
|
|
|
|
Obj_SetVisible(hitbox, true);
|
|
|
|
|
|
|
|
_RenderPlayerMovement(objPlayer, frame, 0, 192, 192, 192, scale, 2, spd);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else{
|
|
|
|
|
|
|
|
_RenderPlayerMovement(objPlayer, frame, 0, 0, 192, 192, scale, 2, spd);
|
|
|
|
|
|
|
|
Obj_SetVisible(hitbox, false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (frame >= (2*spd-1)){frame = 0;}
|
|
|
|
if (frame_hbox >= (3*9-1)){frame_hbox = 0;}
|
|
|
|
|
|
|
|
yield;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
task _DeathMove(){
|
|
|
|
|
|
|
|
int afterimage = ObjPrim_Create(OBJ_SPRITE_2D);
|
|
|
|
|
|
|
|
ObjPrim_SetTexture(afterimage, plimg);
|
|
|
|
ObjSprite2D_SetSourceRect(afterimage, 0, 384, 192, 576);
|
|
|
|
ObjSprite2D_SetDestCenter(afterimage);
|
|
|
|
ObjRender_SetBlendType(afterimage, BLEND_ALPHA);
|
|
|
|
Obj_SetRenderPriorityI(afterimage, 40);
|
|
|
|
|
|
|
|
float[] curdest = [playerX, playerY];
|
|
|
|
float[] dest = [clamp(playerX-256, 0, GetStgFrameWidth()), playerY];
|
|
|
|
|
|
|
|
SetPlayerRebirthPosition(dest[0], dest[1]);
|
|
|
|
|
|
|
|
ascent(i in 0..30){
|
|
|
|
ObjRender_SetPosition(afterimage, Interpolate_Decelerate(curdest[0], dest[0], i/30), playerY, 1);
|
|
|
|
yield;
|
|
|
|
}
|
|
|
|
|
|
|
|
wait(60);
|
|
|
|
|
|
|
|
Obj_Delete(afterimage);
|
|
|
|
|
|
|
|
}
|