From KeenWiki
Jump to navigation Jump to search

The Shikadi are electric blue enemies found in many levels of Keen 5. They take multiple hits to stun and can electrify poles Keen is climbing.

Sprite Type

Shikadi use sprite type 20, used only by themselves. Their pole blasts use type 4, the standard 'enemy shot' type. Their shots will thus affect Shelley, but not much else.

Keen 5

#Blue bird sprite type
%patch $12EDB $14 #Shikadi
%patch $130DA $04 #Shikadi pole zap

Sprite Actions

The Shikadi have 13 actions, four frames of standing, four frames of walking, two blasting poles, one stunned frame and two frames for their pole blast.

Shikadi are created standing still. After four standing frames they will go to walking. While walking they will randomly stop and stand again. When passing a pole tile Shikadi will randomly blast it with electricity. After doing this it will return to walking.

Shikadi sparks move up poles, vanishing when they reach the end of a pole.

$2D10W #Shikadi stand
$2D2EW #Shikadi stand
$2D4CW #Shikadi stand
$2D6AW #Shikadi stand
$2D88W #Shikadi walk
$2DA6W #Shikadi walk
$2DC4W #Shikadi walk
$2DE2W #Shikadi walk
$2E00W #Shikadi zap poles
$2E1EW #Shikadi zap poles
$2E3CW #Shikadi stunned
$2E5AW #Shikadi polezap
$2E78W #Shikadi polezap

Keen 5

#Placed in level
%patch $12F1B [$2D10W] #Shikadi stand

#Stand cycle
%patch $3306C [$2D2EW] #Shikadi stand
%patch $3308A [$2D4CW] #Shikadi stand
%patch $330A8 [$2D6AW] #Shikadi stand
%patch $330C6 [$2D88W] #Shikadi stand (Walk)

#Walk cycle
%patch $330E4 [$2DA6W] #Shikadi walk
%patch $33102 [$2DC4W] #Shikadi walk
%patch $33120 [$2DE2W] #Shikadi walk
%patch $3313E [$2D88W] #Shikadi walk (Keep walking)

#When walking
%patch $12FC3 [$2D10W] #Shikadi stand (Random)
%patch $13029 [$2E00W] #Shikadi polesparks (When passing pole)

#When zapping poles
%patch $3315C [$2E1EW] #Shikadi polesparks
%patch $3317A [$2D88W] #Shikadi polesparks (Walk)

#When shot
%patch $1306D [$2E3CW] #Shikadi stunned

#While stunned
%patch $33198 [$0000W] #Shikadi stunned

#Pole zap created
%patch $130E7 [$2E5AW] #Shikadi polezap

#Pole zap behavior
%patch $13170 [$0000W] #Nothing (When polesparks reach end of poles)

#Pole zap cycle
%patch $331B6 [$2E78W] #Shikadi polezap
%patch $331D4 [$2E5AW] #Shikadi polezap

Sprite Behavior

Shikadi have three behaviors. The first is the walking behavior, this makes the Shikadi randomly stop and stand, and also start blasting poles when near them. The second behavior is to create the pole blast itself, and the third is the pole blast's behavior, moving up or down poles.

$11C412ECRL #Shikadi walk
$11C41455RL #Shikadi create pole zap
$11C414E3RL #Shikadi polezap

Keen 5

%patch $33060 $00000000L  #Nothing
%patch $3307E $00000000L  #Nothing
%patch $3309C $00000000L  #Nothing
%patch $330BA $00000000L  #Nothing

%patch $330D8 $11C412ECRL #Shikadi walk
%patch $330F6 $11C412ECRL #Shikadi walk
%patch $33114 $11C412ECRL #Shikadi walk
%patch $33132 $11C412ECRL #Shikadi walk

#Zap poles
%patch $33150 $11C41455RL #Shikadi create pole zap
%patch $3316E $00000000L  #Nothing

%patch $3318C $090B1710RL #Fall

%patch $331AA $11C414E3RL #Shikadi polezap
%patch $331C8 $11C414E3RL #Shikadi polezap

Shikadi zap poles behavior code

This is the complete behavior code for the Shikadi zapping poles. This is used after a pole has been detected. On the first line the Shikadi's action timer is set to 2 ticks (This is how long it will take to zap poles.) Next its horizontal direction is checked; if it is not facing right ($01) then the spark is produced $30 right of the Shikadi, else it is produced $2C right. This helps position the spark relative to the Shikadi no matter which direction it is facing.

On line 3 a version 1 sprite is spawned. It is positioned 8 pixels down from the Shikadi's top ($0080W) and its type is set to 4 (enemy shot.) Its activity is set to 3 so that it will keep moving when offscreen and thus will not 'wait' for Keen unfairly. Its clipping is set to 0 so it can move through all tiles.

The sparks seek Keen, moving up or down towards him when first created. This is done on line 7 where Keen and the sprite's vertical ($0C, as opposed to horizontal, $0A) locations are checked and its vertical ($10, as opposed to horizontal, $0E) direction is set. Finally sound $28 is played.

Keen 5

#Shikadi polezapping behavior
%patch $13095 $55 $8B $EC $56 $57 $8B $76 $06 $C7 $44 $08 [$0002W]  $83 $7C $0E
              [$01] {$75} $0B $8B $44 [$30] $B1 $08 $D3 $E0 $8B $F8 $EB $09 $8B $44
              [$2C] $B1 $08 $D3 $E0 $8B $F8 $B8 $0001W  $50 $9A $06B91DCDRL
              $83 $C4 $02 $8B $1E $40 $9E $89 $7F $0A $8B $44 $0C $05 [$0080W]
              $89 $47 $0C $C7 $07 [$0004W]  $C7 $47 $02 [$0003W]  $C7 $47 $06 [$0000W]
              $00 $B8 {$2E5AW}  $50 $53 $9A $090B11C4RL     $83 $C4 $04 $8B $44
              [$0C] $8B $1E $3E $9E $3B $47 [$0C] {$73} $0B $8B $1E $40 $9E $C7 $47
              $10 [$0001W]  $EB $09 $8B $1E $40 $9E $C7 $47 $10 [$FFFFW]  $B8 [$0028W]
                  $50 $9A $196E09EFRL     $83 $C4 $02 $5F $5E $5D $CB

Seeking Keen

There are a number of ways in which the Shikadi seek Keen. Notably, when Keen is level with them they will head towards him. It is possible also to alter the 'horizontal\vertical sensitivity' of the Shikadi so they will seek Keen when he is further from level with them or further away.

The Shikadi's pole sparks also seek Keen, though this can be hard to see. They will chase him vertically on a pole, which usually means they are headed upwards towards him.

Keen 5

#When Keen is level with it, Shikadi heads for him:
%patch $12F86 [$0001W]
%patch $12F70 [$FFFFW]

#How far from Keen l/r Shikadi must be before seeking him
%patch $12F66 [$0100W] #1 tile left
%patch $12F7C [$0100W] #1 tile right

#What vertical level is 'level' with the Shikadi (Keen's feet relative to sprite top)
%patch $12F57 [$0100W] #1 tile down to
%patch $12F5A [$0200W] #2 tiles down

#Polesparks head vertically for Keen
%patch $13106 [$0001W]
%patch $13111 [$FFFFW]

Pole sparks chase Keen horizontally

This patch makes the pole sparks chase Keen horizontally instead of vertically. Used with the default sprites this is a useless patch, since pole sparks must move up or down poles, but it can be useful in more complex patches (See below.)

Keen 5

#Polesparks check horizontally, not vertically for Keen:
%patch $130F5 $0A
%patch $130FC $0A

Shikadi can make blasts even when not near a pole

This patch allows the Shikadi to produce pole blasts whenever it wants, instead of only on poles. However this is rather ineffective unless the pole blast's behavior is changed to not need poles. (An example patch that does this is given in the 'Misc' section below.) It is also wise to adjust how often the Shikadi pole sparks, by altering its probability, given by the blue highlighted value. (Lower value means less often.)

Keen 5

#Don't have to be in front of a pole to zap
%patch $13011 $90 $90 $90 $90 $8B $9A $1DFB0036RL [$0080W] $7D $1D


The only non-animation speed the Shikadi have is the speed of their pole sparks, which is set when they are created. Everything else is tied to animation motion. Even then only the Shikadi's walking speed is used.

Keen 5

#Pole spark speed:
%patch $13139 [$0030W]

Animation motion

#Shikadi stand
%patch $3305C [$0000W $0000W]
%patch $3307A [$0000W $0000W]
%patch $33098 [$0000W $0000W]
%patch $330B6 [$0000W $0000W]

%patch $330D4 [$0080W $0000W]
%patch $330F2 [$0080W $0000W]
%patch $33110 [$0080W $0000W]
%patch $3312E [$0080W $0000W]

%patch $3314C [$0000W $0000W]
%patch $3316A [$0000W $0000W]

%patch $33188 [$0000W $0000W]

#Polezap sparks
%patch $331A6 [$0000W $0000W]

Sprite Collision

The Shikadi's collision is quite basic, it takes multiple hits to stun, but is easily stunned and turned into a stunned Shikadi.

Collision values

There are two collisions used by the Shikadi. The Shikadi itself uses its specialized collision in all frames except when it is stunned. The Shikadi's pole sparks on the other hand uses a general 'deadly to Keen' collision that also means it cannot be shot\destroyed. The Shikadi takes four shots to stun by default.

Keen 5 collision values

%patch $33064 $11C41403RL #Shikadi
%patch $33082 $11C41403RL #Shikadi
%patch $330A0 $11C41403RL #Shikadi
%patch $330BE $11C41403RL #Shikadi

%patch $330DC $11C41403RL #Shikadi
%patch $330FA $11C41403RL #Shikadi
%patch $33118 $11C41403RL #Shikadi
%patch $33136 $11C41403RL #Shikadi

%patch $33154 $11C41403RL #Shikadi
%patch $33172 $11C41403RL #Shikadi

%patch $33190 $00000000L  #Nothing

#Polezap sparks
%patch $331AE $090B1799RL #Deadly
%patch $331CC $090B1799RL #Deadly

Shikadi's strength

This patch controls the Shikadi's strength. It is set when the sprite is spawned.

Shikadi strength

#Shikadi's strength
%patch $12EFA [$0004W]

Collision code

This is the complete Shikadi collision code. It responds to both Keen and Keen's shot types. On the first line a check for Keen is made, if Keen-type is found then the 'kill Keen' code is run at the start of line two. Also on line two is the check for Keen's shot type. If it is not found the following code is skipped.

At the end of line 3 a check is made to see if the sprite's strength (Parameter 40) is zero. If so then the Sprite's X and Y motion are set to 0 and its action to 'stunned Shikadi'. Otherwise the Shikadi's 'flash time' is set to 2 and flash set to 1 (This makes the Shikadi flash when shot.) This also removes 1 from the Shikadi's strength.

Keen 5

#Shikadi collision code
%patch $13043 $55 $8B $EC $56 $57 $8B $76 $06 $8B $7E $08 $83 $3D [$02] {$75} $05
              $9A $0AAF1517RL     $83 $3D [$03] {$75} $34 $FF $4C {$40 $75} $1C $C7
              $44 $16 [$0000W]  $C7 $44 $18 [$0000W]  $B8 {$2E3CW}  $50 $57 $56 $9A
              $090B16CDRL     $83 $C4 $06 $5F $5E $5D $CB $C7 $44 $42 $0002W
              $C7 $44 $04 $0001W  $57 $9A $0CCB10B3RL     $83 $C4 $02 $5F $5E
              $5D $CB

Shikadi doesn't flash when shot

This patch stops the Shikadi from flashing white when shot but not stunned.

Keen 5

#Shikadi doesn't flash when shot
%patch $1307E $EB $03


The Shikadi's animations are moderately complex. Four frames are used for standing, the same animation being used no matter which direction the Shikadi stands facing. Standing animation speeds control how long the Shikadi will pause to stand. Eight frames are used when walking, four for each direction, walking animation speeds affect the Shikadi's walking speed. Two frames are used when zapping poles, one for each direction, but only one frame is sued when stunned. The zapping animation speeds likewise control how long it takes a Shikadi to zap a pole. The animation speed does not affect the Shikadi's polezap by default, its animation is defined in its code.

Keen 5

%patch $31A30 [$0140W] #Shikadi cache start
%patch $31A84 [$0150W] #Cache end

#Shikadi stand
%patch $33050 $0140W $0140W
%patch $3305A $0008W        #Animation speed
%patch $3306E $0141W $0141W
%patch $33078 $0008W        #Animation speed
%patch $3308C $0142W $0142W
%patch $33096 $0008W        #Animation speed
%patch $330AA $0143W $0143W
%patch $330B4 $0008W        #Animation speed

#Shikadi walk
%patch $330C8 $014CW $0148W
%patch $330D2 $0008W        #Animation speed
%patch $330E6 $014DW $0149W
%patch $330F0 $0008W        #Animation speed
%patch $33104 $014EW $014AW
%patch $3310E $0008W        #Animation speed
%patch $33122 $014FW $014BW
%patch $3312C $0008W        #Animation speed

#Shikadi polezaps
%patch $33140 $0145W $0144W
%patch $3314A $0014W        #Animation speed
%patch $3315E $0145W $0144W
%patch $33168 $0014W        #Animation speed

#Shikadi stunned
%patch $3317C $0150W $0150W #Shikadi stunned
%patch $33186 $0000W        #Animation speed

#Shikadi polezap
%patch $3319A $0146W $0146W
%patch $331A4 $0000W        #Animation speed
%patch $331B8 $0146W $0146W
%patch $331C2 $0000W        #Animation speed


The Shikadi plays two sounds; the first is when a Shikadi grabs a pole, the second when it creates a pole spark. These sounds are both the same, and as grabbing a pole leads directly to zapping the grabbing sound is redundant and not actually noticed. Both sounds can be blocked.

Keen 5

%patch $13032 $28     #Shikadi grab poles sound
%patch $13114 $28     #Shikadi zap poles sound

#Block sounds
%patch $13031 $EB $0A #Don't play Shikadi grab poles sound
%patch $13113 $EB $0A #Don't play Shikadi zap poles sound

Sprite positioning and zap height

There are two positioning variable to the Shikadi. The first is their spawn height. The second is the height at which their pole zap shot is produced. This is 1/2 a tile down from the Shikadi's head.

Keen 5

#Shikadi spawn height
%patch $12EF2 [$FF00W] #1 tile up

#Vertical height zap spawned at
%patch $130D3 [$0080W] #Half a tile down

Sprite-tile interaction

There are two tile collisions used by the Shikadi. The first is a specialized code that lets it walk back and forth on solid tiles, and zap poles when it touches them. The second is a 'sit' collision used to stop the Shikadi's pole sparks from entering solid tiles.

Keen 5

%patch $33068 $11C41538RL #Shikadi
%patch $33086 $11C41538RL #Shikadi
%patch $330A4 $11C41538RL #Shikadi
%patch $330C2 $11C41538RL #Shikadi

%patch $330E0 $11C41538RL #Shikadi
%patch $330FE $11C41538RL #Shikadi
%patch $3311C $11C41538RL #Shikadi
%patch $3313A $11C41538RL #Shikadi

%patch $33158 $11C41538RL #Shikadi
%patch $33176 $11C41538RL #Shikadi

%patch $33194 $090B195ARL #Stunned

#Pole sparks
%patch $331B2 $090B17B5RL #Sit
%patch $331D0 $090B17B5RL #Sit

Action type

The Shikadi uses an interesting mix of action types. Most of its types are type 0, meaning its walking motion is slightly jerky. The stunned Shikadi uses type 2, as do most stunned sprites, while the pole sparks use type 3, giving them instant reactions and smooth movement.

Keen 5

%patch $33054 {$0000W}
%patch $33072 {$0000W}
%patch $33090 {$0000W}
%patch $330AE {$0000W}

%patch $330CC {$0000W}
%patch $330EA {$0000W}
%patch $33108 {$0000W}
%patch $33126 {$0000W}

%patch $33144 {$0000W}
%patch $33162 {$0000W}

%patch $33180 {$0002W}

%patch $3319E {$0003W}
%patch $331BC {$0003W}

Deprotect and stick to ground

The Shikadi needs to move up and down hills, so it uses the stick to ground variable, though its stunned frame and sparks do not. It has no use for the deprotect animation variable, this is always 0.

Keen 5

%patch $33056 [$0000W $0001W] #Move on hills
%patch $33074 [$0000W $0001W] #Move on hills
%patch $33092 [$0000W $0001W] #Move on hills
%patch $330B0 [$0000W $0001W] #Move on hills

%patch $330CE [$0000W $0001W] #Move on hills
%patch $330EC [$0000W $0001W] #Move on hills
%patch $3310A [$0000W $0001W] #Move on hills
%patch $33128 [$0000W $0001W] #Move on hills

%patch $33146 [$0000W $0001W] #Move on hills
%patch $33164 [$0000W $0001W] #Move on hills

%patch $33182 [$0000W $0000W]

#Pole sparks
%patch $331A0 [$0000W $0000W]
%patch $331BE [$0000W $0000W]

Probability and randomness

There are two sources of random events Shikadi can do. The first is their initial direction when created, a 50/50 proposition. The second is the chance the Shikadi will stand, if Keen is not on the same ground level it is. This is far less often, $10 = about 1 in 16.

Keen 5

#Chance of facing left when spawned
%patch $12F02 $80

#Chance of going to standing (IF Keen is not level with it!)
%patch $12FB6 $10

Sprite spawn code

Only partial spawn code is available for the Shikadi. Notice that there are three types of Shikadi, one for each difficulty. The Shikadi's cache is set in $C7 $06 $C283W $0001W

The last blue highlighted value is the sprite action the sprite uses as it proceeds to act in-level. $C7 $47 $02 $xxxxW sets the sprite activity, $C7 $47 $06 $xxxxW sets the clipping, $C7 $07 $xxxxW sets the sprite type, $C7 $20 $xxxxW sets the foreground value. The Shikadi also has $C7 $47 $40 $xxxxW set its strength. Finally $D3 $E0 $05 $xxxx is how far down (Or more usually up) the sprite is spawned from where it is placed. This is necessary for sprites that walk on the ground as they can only be placed in the level at multiples of 16 pixels high while their actual height can be anything.

$C7 $47 $0E $xxxxW is the horizontal direction the sprite starts moving in, either $0001W (Facing right), $FFFFW (Facing left) or $0000W (Neither, never used.) $C7 $47 $10 $xxxxW is the vertical direction and works similarly. The Shikadi has a probability check to determine which way they face this is 50:50 by default (Though it needn't be.) (the code responsible for this is $9A $1D02002ARL $3D $0080W.)

Keen 5

#Location of initiation code
%patch $F58A [$5EDW]  #Easy Shikadi (At $F33D)
%patch $F58C [$5E6W]  #Normal Shikadi (At $F336)
%patch $F58E [$5DFW]  #Hard Shikadi (At $F32F)

#Shikadi Initiation code
%patch $F32F $83 $3E {$6F6CW}  [$03] {$7C} $71 $83 $3E {$6F6CW}  [$02] {$7C} $6A $57 $56
             $9A $11C41287RL     $83 $C4 $04 $C7 $06 $C283W  $0001W  $EB $58

#Shikadi spawn code
%patch $12EC7 $55 $8B $EC $33 $C0 $50 $9A $06B91DCDRL     $83 $C4 $02 $8B $1E
              $40 $9E $C7 $07 [$0014W]  $C7 $47 $02 [$0001W]  $8B $46 $06 $B1 $08
              $D3 $E0 $89 $47 $0A $8B $46 $08 $D3 $E0 $05 [$FF00W]  $89 $47 $0C
              $C7 $47 $40 [$0004W]  $9A $1DFB0036RL     $3D [$0080W]  $7D $0B $8B
              $1E $40 $9E $C7 $47 $0E [$0001W]  $EB $09 $8B $1E $40 $9E $C7 $47
              $0E [$FFFFW]  $B8 [$2D10W]  $50 $FF $36 $40 $9E $9A $090B11C4RL
              $83 $C4 $04 $5D $CB


Shikadi pole blasts move horizontally towards Keen

This patch alters things so that the Shikadi's pole sparks do not move up poles, but instead move horizontally towards Keen when produced. This makes them an entirely different form of attack.

Keen 5

#Polesparks move horizontally. They also animate and (mostly) move toward Keen
#SIDE EFFECT: Polesparks don't always go in Keen's direction
%patch $130F5 $0A		#Zap 1 checks horizontally for Keen, not vertically
%patch $130FC $0A		#Zap 2 checks horizontally for Keen, not vertically

%patch $13105 $0E		#Zap 1 (mostly) heads horizontally for Keen, not vertically
%patch $13110 $0E		#Zap 2 (mostly) heads horizontally for Keen, not vertically

%patch $331A4 $0003W		#Zap frame 1 animates
%patch $331C2 $0003W		#Zap frame 2 animates

%patch $331AA $00000000L	#Zap frame 1 ignores vertical speed stuff
%patch $331C8 $00000000L	#Zap frame 2 ignores vertical speed stuff

%patch $331A6 $0040W		#Zap frame 1 speed
%patch $331C4 $0040W		#Zap frame 2 speed