Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const int CR_LEVEL = 7;
- const int CR_HEART_CT = 8;
- const int CR_MAGIC_CT = 9;
- const int CR_HP = 10;
- const int CR_MP = 11;
- const int CR_XP = 12;
- int EXP_Counter = 0;
- int Level_Counter = 1;
- int Level_Damage = 0;
- float Num_Hearts;
- float Num_Magics;
- int LinkXP_DrawX;
- int LinkXP_DrawY;
- const int DRAW_XP_OFFSET = 12;
- const int ENEMY_XP_VALUE = 10;
- const int DRAW_XP_FRAMES = 70;
- const int TOP_Y_OFFSET = 4;
- const int BOTTOM_Y_OFFSET = -12;
- const int RIGHT_X_OFFSET = -4;
- const int LEFT_X_OFFSET = 12;
- const int DRAW_INT_COLOR = 1;
- const int DRAW_INT_BG = 0;
- //DrawInteger(int layer, int x, int y, int font,int color, int background_color,int width, int height, int number, int number_decimal_places, int opacity);
- int JumpPixles = 3;
- int JumpFrames = 0;
- bool DoubleJumping = false;
- const int DOUBLE_JUMP_ITEM = 143;
- const int SCREEN_W = 256;
- const int SCREEN_H = 176;
- bool InAir = false;
- //Shorthand way of drawing an integer. I should probably add this to my own import file eventually too.
- void QuickInteger(int x, int y, int number){
- Screen->DrawInteger(7, x, y, FONT_Z1, 1, 0, -1, -1, number, 0, OP_OPAQUE);
- }
- global script SC_Global_V1{
- void run(){
- while(true){
- Game->Counter[CR_SCRIPT1] = Level_Counter;
- Num_Hearts = ( Link->HP / 16 );
- Game->Counter[CR_SCRIPT2] = Num_Hearts;
- Num_Magics = Link->MP;
- Game->Counter[CR_SCRIPT3] = Num_Magics;
- Game->Counter[CR_SCRIPT4] = Link->HP;
- Game->Counter[CR_SCRIPT5] = Link->MP;
- Game->Counter[CR_SCRIPT6] = EXP_Counter;
- Game->Counter[CR_SCRIPT7] = Link->MaxHP;
- Game->Counter[CR_SCRIPT8] = Link->MaxMP;
- Game->Counter[CR_SCRIPT9] = 1000;
- for ( int e = 1; e < ( Screen->NumNPCs() + 1 ); e++ ) {
- npc exp_enemy = Screen->LoadNPC(e);
- int worth = exp_enemy->Attributes[ENEMY_XP_VALUE];
- if ( exp_enemy->HP <= 0 ) {
- EXP_Counter += worth;
- for ( int q = DRAW_XP_FRAMES; q > 0; q-- ) {
- if ( Link->X >= 128 ) {
- LinkXP_DrawX = Link->X + DRAW_XP_OFFSET + RIGHT_X_OFFSET;
- }
- if ( Link->X <= 0 ) {
- LinkXP_DrawX = Link->X + DRAW_XP_OFFSET + LEFT_X_OFFSET;
- }
- else {
- LinkXP_DrawX = Link->X + DRAW_XP_OFFSET;
- }
- if ( Link->Y >= 176 ) {
- LinkXP_DrawY = Link->Y + DRAW_XP_OFFSET + BOTTOM_Y_OFFSET;
- }
- else if ( Link->Y <= 0 ) {
- LinkXP_DrawY = Link->Y + DRAW_XP_OFFSET + TOP_Y_OFFSET;
- }
- else {
- LinkXP_DrawY = Link->Y + DRAW_XP_OFFSET;
- }
- QuickInteger(LinkXP_DrawX, LinkXP_DrawY, worth);
- Waitframe();
- }
- }
- }
- Level_Damage = (Level_Counter / 4);
- if(Link->Action == LA_ATTACKING)
- {
- Link->Jump = 0;
- }
- TapJump();
- Melee_Damage(5, 50); // 122 for Whimsical Ring
- UpdateLevel();
- Waitdraw();
- Waitframe();
- }
- }
- }
- // ====
- //
- // FUNCTION LIST
- //
- // Why are they down here? I dunno, but someone put one here and I am just rolling with it.
- //
- // ====
- bool SV_OnGround() // Detects if Link is on a solid combo, mainly to be used in Sideview.
- {
- if(Screen->isSolid(Link->X, Link->Y + 16) == true || Screen->isSolid(Link->X + 15, Link->Y + 16) == true)
- {return true;}
- }
- bool SV_UnderCombo() // Detects if Link is under a solid combo, mainly to be used in Sideview.
- {
- if(Screen->isSolid(Link->X, Link->Y - 16) == true || Screen->isSolid(Link->X + 15, Link->Y - 16) == true)
- {return true;}
- }
- void UpdateLevel() // Updates the EXP Level.
- {
- if ( EXP_Counter >= 100 )
- {
- Level_Counter += 1;
- EXP_Counter = 0;
- }
- }
- void Melee_Damage(int loadItem, int itemPower)
- {
- itemdata ID = Game->LoadItemData(loadItem);
- ID->Power = itemPower;
- }
- // Quicker way of drawing a rectangle/square.
- void QuickRect(int layer, int x, int y, int x2, int y2, int color, bool fill)
- {
- Screen->Rectangle(layer, x, y, x2, y2, color, -1, 0, 0, 0, fill, OP_OPAQUE);
- }
- void TapJump() // Makes Link Jump
- {
- if(Link->InputR == true && SV_OnGround() == true && JumpFrames <= 10)
- {
- if(SV_UnderCombo() == false)
- {
- Game->PlaySound(45);
- DoubleJumping = false;
- for(int i = 0; i < 8; i += 1)
- {
- Link->Y -= JumpPixles;
- JumpFrames += 1;
- InAir = true;
- Waitframe();
- }
- }
- }
- if(SV_OnGround() == true)
- {
- JumpFrames = 0;
- Waitframe();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement