Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \\
- // Coolgamers Z3 Scrolling, Version 2 Update/Itteration 4 Module 3. \\
- // Module 3: \\
- // Custom weapons. \\
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ \\
- // ~ Misc Constants ~
- const int SCRL_LW_DEADSTATE_DEAD = 0; // Removes the weapon.
- const int SCRL_LW_DEADSTATE_ALIVE = -1; // Weapon isn't removed over time.
- // ~ ->Misc[] indices ~
- const int MISC_LW_DEADSTATE = 0; // Custom deadstate, basically.
- const int MISC_LW_NORMAL_FLAGS = 1; // Stores a set of flags that change the behavior of the weapon.
- const int MISC_LW_SCRIPT_FLAGS = 2; // Stores a set of flags that change the behavior of the weapon on a more technical level.
- const int MISC_LW_SPAWN_X = 3; // The X position that the weapon was spawned at.
- const int MISC_LW_SPAWN_Y = 4; // The Y position that the weapon was spawned at.
- // ~ Scripted Weapon Types (sword, spear, boomerang, etc) ~
- // Put these in D0 in the item editor, before the decimal point.
- const int SCRL_LW_NONE = 41; // No built in use currently.
- const int SCRL_LW_TESTWEP = 42;
- // ~ Scripted Weapon Flags ~
- // Script-related flags; You probably don't want to mess with these too much. Probably.
- // The sum of all the flags you want to use is the number to put in D1, before the decimal point.
- // WARNING: The functionality of these hasn't been implimented (or completely) yet, they also may be changed in the future.
- const int SCRL_WEP_FLAG_HURTSLINK = 00000000001b; // Hurts Link
- const int SCRL_WEP_FLAG_HURTSENEMY = 00000000010b; // Hurts Enemies
- const int SCRL_WEP_FLAG_DESTROYED_ON_LINK = 00000000100b; // Destroys the weapon when it hits Link
- const int SCRL_WEP_FLAG_DESTROYED_ON_ENEMY = 00000001000b; // Destroys the weapon when it hits an Enemy
- const int SCRL_WEP_FLAG_DESTROYED_ON_SOLID_COMBO = 00000010000b; // Destroys the weapon when it hits any solidity in a combo.
- const int SCRL_WEP_FLAG_OBEY_SIDEVIEW_GRAVITY = 00000100000b; // If the weapons Z pos decreases when > 0 in normal screens.
- const int SCRL_WEP_FLAG_OBEY_Z_GRAVITY = 00001000000b; // If the weapons Y pos decreases when > 0 in sideview screens.
- const int SCRL_WEP_FLAG_TRANSPARENT = 00010000000b; // If the weapon is Transparent.
- const int SCRL_WEP_FLAG_INVISIBLE = 00100000000b; // If the weapon is Invisible.
- const int SCRL_WEP_FLAG_CAN_BE_REFLECTED = 01000000000b; // If the weapon can be reflected by mirrors/shields/etc
- const int SCRL_WEP_FLAG_PICKUPITEMS = 10000000000b; // If the weapon will pickup items;
- // A flag on the items themselves will choose if they're instantly collected or pulled with the weapon.
- // ~ Functions ~
- lweapon CreateCustomWeapon(int wepType, int wepFlags, int scriptWepFlags, int wepSprite, int wepDeadState, int x, int y)
- {
- lweapon lwep = CreateLWeaponAt(wepType, 120, 80);
- lwep->HitXOffset = (x - 120);
- lwep->HitYOffset = (y - 80);
- lwep->DrawXOffset = lwep->HitXOffset;
- lwep->DrawYOffset = lwep->HitYOffset;
- lwep->Misc[MISC_LW_DEADSTATE] = wepDeadState;
- lwep->Misc[MISC_LW_NORMAL_FLAGS] = wepFlags;
- lwep->Misc[MISC_LW_SCRIPT_FLAGS] = scriptWepFlags;
- lwep->Misc[MISC_LW_SPAWN_X] = x;
- lwep->Misc[MISC_LW_SPAWN_Y] = y;
- lwep->UseSprite(wepSprite);
- lwep->CollDetection = false;
- return lwep;
- }
- void HandleCustomWeapons()
- {
- for(int i = 1; i <= Screen->NumLWeapons(); i += 1)
- {
- lweapon lwep = Screen->LoadLWeapon(i);
- if(lwep->ID == SCRL_LW_TESTWEP)
- {
- lwep->DeadState = WDS_ALIVE;
- if(lwep->Misc[MISC_LW_DEADSTATE] == SCRL_LW_DEADSTATE_DEAD)
- {
- Remove(lwep);
- }
- else
- {
- lwep->Misc[MISC_LW_DEADSTATE] -= 1;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment