User:Monster Iestyn/2.2 Custom Monitor example
Jump to navigation
Jump to search
For the below example, we will be recreating the Super Ring Monitor (10 Rings) as implemented in 2.2.
Sprite frames organisation
Following the existing examples of sprite sets for monitors in unmodified SRB2, the frames for your monitor's sprite set should be as follows:
- A – the regular monitor's main sprite, with the icon showing.
- B – the golden monitor's main sprite, with the icon showing. (Note: ring monitors do not have golden monitor versions for hopefully obvious reasons, this is just for reference!)
- C – the monitor's icon on its own, facing the camera.
- D to F – combined with frame C, these frames form the monitor icon's vertical rotation animation, which displays after you have just popped the monitor and before the icon stops moving. See how the existing examples look in srb2.pk3, I'm not going to explain what angles the frames are individually here.
SOC
# First, we create the resources we need Freeslot MT_CUSTOMRING_BOX # the monitor's object type MT_CUSTOMRING_ICON # the icon's object type S_CUSTOMRING_BOX # the monitor's icon-showing state S_CUSTOMRING_ICON1 # the icon's flipping state S_CUSTOMRING_ICON2 # the icon's giving-you-the-actual-powerup state SPR_TVCR # the monitor's sprite set # Next, let's define the object types # the monitor's object type Object MT_CUSTOMRING_BOX MapThingNum = 499 SpawnState = S_CUSTOMRING_BOX SpawnHealth = 1 ReactionTime = 8 PainState = S_CUSTOMRING_BOX DeathState = S_BOX_POP1 # the standard death state for all monitors DeathSound = sfx_pop Speed = 1 Radius = 18*FRACUNIT Height = 40*FRACUNIT Mass = 100 Damage = MT_CUSTOMRING_ICON # the icon type to spawn on being popped Flags = MF_SOLID|MF_SHOOTABLE|MF_MONITOR # the icon's object type Object MT_CUSTOMRING_ICON MapThingNum = -1 SpawnState = S_CUSTOMRING_ICON1 SpawnHealth = 1 SeeSound = sfx_itemup # (this sound may only be relevant to A_RingBox and related in this example) Speed = 2*FRACUNIT Radius = 8*FRACUNIT Height = 14*FRACUNIT Mass = 100 Damage = 62*FRACUNIT # the height that the icon can go up before it stops Flags = MF_NOBLOCKMAP|MF_NOCLIP|MF_SCENERY|MF_NOGRAVITY|MF_BOXICON # Now let's define the states # the monitor's icon-showing state State S_CUSTOMRING_BOX SpriteName = TVCR SpriteFrame = A Duration = 2 Next = S_BOX_FLICKER # this takes the monitor to the standard "static" icon state, which eventually returns to the spawnstate # the icon's flipping state State S_CUSTOMRING_ICON1 SpriteName = TVCR SpriteFrame = FF_ANIMATE|C Duration = 18 Var1 = 3 # number of frames to cycle through (i.e. the last frame before looping is SpriteFrame + 3, which for us is F) Var2 = 4 # frame duration in tics Next = S_CUSTOMRING_ICON2 # the stopping state, see below # the icon's giving-you-the-actual-powerup state State S_CUSTOMRING_ICON2 SpriteName = TVCR SpriteFrame = C Duration = 18 Action = A_RingBox # The action that the monitor is intended to do on being popped Var1 = 0 # the relevant vars (these do nothing for A_RingBox, this is just for reference) Var2 = 0 # etc Next = S_NULL # disappear after we're done # ...and that's it! Congratulations, you now have a custom monitor!