This commit is contained in:
Aria 2025-03-21 22:23:30 +11:00
commit 9c94d113d3
Signed by untrusted user who does not match committer: aria
GPG key ID: 19AB7AA462B8AB3B
10260 changed files with 1237388 additions and 0 deletions

View file

@ -0,0 +1,124 @@
function init()
self.state = stateMachine.create({
"idleState",
"attackState",
})
self.state.leavingState = function(stateName)
entity.setAnimationState("movement", "idle")
end
self.initialPauseTimer = entity.configParameter("initialPauseTime")
entity.setDeathParticleBurst("deathPoof")
entity.setAggressive(true)
entity.setDamageOnTouch(true)
end
--------------------------------------------------------------------------------
function update(dt)
if self.initialPauseTimer > 0 then
self.initialPauseTimer = self.initialPauseTimer - dt
else
if util.trackTarget(entity.configParameter("targetNoticeDistance")) then
self.state.pickState(self.targetId)
end
self.state.update(dt)
end
end
--------------------------------------------------------------------------------
function boundingBox(offset)
local position = mcontroller.position()
if offset ~= nil then position = vec2.add(position, offset) end
local bounds = entity.configParameter("metaBoundBox")
return {
bounds[1] + position[1],
bounds[2] + position[2],
bounds[3] + position[1],
bounds[4] + position[2],
}
end
--------------------------------------------------------------------------------
function isClosed()
return entity.animationState("movement") == "closedIdle"
end
--------------------------------------------------------------------------------
function isOnPlatform()
local bounds = boundingBox({ 0, -1 })
return mcontroller.onGround() and
world.rectTileCollision(bounds, {"Platform"})
end
--------------------------------------------------------------------------------
function move(toTarget)
entity.setAnimationState("movement", "move")
if math.abs(toTarget[2]) < 4.0 and isOnPlatform() then
mcontroller.controlDown()
end
mcontroller.controlMove(toTarget[1], true)
end
--------------------------------------------------------------------------------
idleState = {}
function idleState.enter()
if isClosed() then return nil end
return { timer = entity.randomizeParameterRange("idleBlinkIntervalRange") }
end
function idleState.update(dt, stateData)
stateData.timer = stateData.timer - dt
if stateData.timer <= 0 then
entity.setAnimationState("movement", "blink")
stateData.timer = entity.randomizeParameterRange("idleBlinkIntervalRange")
end
return false
end
--------------------------------------------------------------------------------
attackState = {}
function attackState.enterWith(targetId)
if targetId == nil then return nil end
if isClosed() then
entity.setAnimationState("movement", "open")
end
return {
timer = entity.configParameter("attackTargetHoldTime"),
targetId = targetId,
targetPosition = world.entityPosition(targetId),
}
end
function attackState.update(dt, stateData)
if entity.animationState("movement") == "open" then
return false
end
local targetPosition = world.entityPosition(stateData.targetId)
if targetPosition == nil then return true end
if entity.entityInSight(stateData.targetId) then
stateData.targetPosition = targetPosition
stateData.timer = entity.configParameter("attackTargetHoldTime")
else
stateData.timer = stateData.timer - dt
end
local toTarget = world.distance(stateData.targetPosition, mcontroller.position())
move(toTarget)
return stateData.timer <= 0
end

View file

@ -0,0 +1,9 @@
{
"name" : "body",
"category" : "tentaclecometspore",
"type" : "body",
"frames" : {
"body" : "tentaclecometspore.png"
}
}

View file

@ -0,0 +1,13 @@
{
"frameGrid" : {
"size" : [40, 48],
"dimensions" : [8, 4],
"names" : [
[ null, "idle", null, "jump", null, "fall", null, null ],
[ null, "blink.1", "blink.2", "blink.3", null, null, null ],
[ "open.1", "open.2", "open.3", "open.4", "open.5", "open.6", "open.7", "open.8" ],
[ "walk.1", "walk.2", "walk.3", "walk.4", "walk.5", "walk.6", "walk.7", "walk.8" ]
]
}
}

View file

@ -0,0 +1,279 @@
{
"animatedParts" : {
"stateTypes" : {
"movement" : {
"priority" : 0,
"default" : "closedIdle",
"states" : {
"closedIdle" : {
"frames" : 1
},
"idle" : {
"frames" : 1
},
"jump" : {
"frames" : 1
},
"fall" : {
"frames" : 1
},
"blink" : {
"frames" : 3,
"mode" : "transition",
"transition" : "idle"
},
"open" : {
"frames" : 8,
"mode" : "transition",
"transition" : "idle"
},
"move" : {
"frames" : 8,
"mode" : "loop"
}
}
}
},
"parts" : {
"body" : {
"partStates" : {
"movement" : {
"closedIdle" : {
"properties" : {
"image" : "<partImage>:open.1"
}
},
"idle" : {
"properties" : {
"image" : "<partImage>:idle"
}
},
"jump" : {
"properties" : {
"image" : "<partImage>:jump"
}
},
"fall" : {
"properties" : {
"image" : "<partImage>:fall"
}
},
"blink" : {
"properties" : {
"image" : "<partImage>:blink.<frame>"
}
},
"open" : {
"properties" : {
"image" : "<partImage>:open.<frame>"
}
},
"move" : {
"properties" : {
"image" : "<partImage>:walk.<frame>"
}
}
}
}
}
}
},
"particleEmitters" : {
"deathPoof" : {
"particles" : [
{
"particle" : {
"type" : "animated",
"animation" : "/animations/puff2c/puff2c.animation",
"size" : 1,
"angularVelocity" : 35,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [0, 0],
"finalVelocity" : [0, 0],
"approach" : [1, 1],
"timeToLive" : 0.4,
"layer" : "middle"
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz1/fizz1.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [-8, 8],
"finalVelocity" : [-3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [-4, 2],
"finalVelocity" : [-3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz1/fizz1.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [8, 8],
"finalVelocity" : [3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [4, 2],
"finalVelocity" : [3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz2/fizz2.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [-8, 8],
"finalVelocity" : [-3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [-4, 2],
"finalVelocity" : [-3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz2/fizz2.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [8, 8],
"finalVelocity" : [3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [4, 2],
"finalVelocity" : [3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz3/fizz3.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [-8, 8],
"finalVelocity" : [-3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [-4, 2],
"finalVelocity" : [-3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz3/fizz3.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [8, 8],
"finalVelocity" : [3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [4, 2],
"finalVelocity" : [3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz4/fizz4.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [-8, 8],
"finalVelocity" : [-3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [-4, 2],
"finalVelocity" : [-3, -4]
}
}
},
{
"particle" : {
"type" : "animated",
"animation" : "/animations/fizz4/fizz4.animation",
"size" : 1,
"angularVelocity" : 20,
"fade" : 1,
"destructionTime" : 7,
"position" : [0, 0],
"initialVelocity" : [8, 8],
"finalVelocity" : [3, -4],
"approach" : [15, 15],
"timeToLive" : 3.45,
"layer" : "middle",
"variance" : {
"initialVelocity" : [4, 2],
"finalVelocity" : [3, -4]
}
}
}
]
}
},
"effects" : {
"blink" : {
"type" : "flash",
"time" : 0.25,
"directives" : "fade=ffffff;0.5"
}
},
"sounds" : {
"turnHostile" : [ ],
"deathPuff" : [ "/sfx/npc/enemydeathpuff.ogg" ]
}
}

View file

@ -0,0 +1,105 @@
{
"type" : "tentaclecometspore",
"categories" : [ "tentaclecometspore" ],
"parts" : [ "body" ],
"animation" : "tentaclecometspore.animation",
"reversed" : true,
"dropPools" : [ "robotTreasure" ],
"baseParameters" : {
"scripts" : [
"/monsters/boss/tentaclecometspore/behavior.lua",
"/scripts/stateMachine.lua",
"/scripts/util.lua",
"/scripts/vec2.lua"
],
"metaBoundBox" : [-2.25, -1.75, 1.875, 1.0],
"scale" : 1.0,
"movementSettings" : {
"collisionPoly" : [ [-2.25, -1.75], [1.875, -1.75], [1.875, 1.0], [-2.25, 1.0] ],
"mass" : 1.0,
"walkSpeed" : 6,
"runSpeed" : 8,
"jumpSpeed" : 5,
"flySpeed" : 15,
"airFriction" : 0.25,
"airForce" : 50.0
},
"bodyMaterialKind" : "organic",
"knockoutTime" : 0.1,
"knockoutEffect" : "blink",
"deathParticles" : "deathPoof",
"touchDamage" : {
"poly" : [ [-2.25, -1.75], [1.875, -1.75], [1.875, 1.0], [-2.25, 1.0] ],
"damage" : 12,
"teamType" : "enemy",
"damageSourceKind" : "bite",
"statusEffects" : [ ]
},
"statusSettings" : {
"statusProperties" : {
"targetMaterialKind" : "organic"
},
"appliesEnvironmentStatusEffects" : false,
"minimumLiquidStatusEffectPercentage" : 0.1,
"primaryScriptSources" : [
"/stats/monster_primary.lua"
],
"primaryScriptDelta" : 5,
"stats" : {
"knockbackStunTime" : {
"baseValue" : 0.25
},
"knockbackThreshold" : {
"baseValue" : 10
},
"maxHealth" : {
"baseValue" : 60
},
"protection" : {
"baseValue" : 1.0
},
"healthRegen" : {
"baseValue" : 0.0
}
},
"resources" : {
"stunned" : {
"deltaValue" : -1.0,
"initialValue" : 0.0
},
"health" : {
"maxStat" : "maxHealth",
"deltaStat" : "healthRegen",
"defaultPercentage" : 100
}
}
},
"mouthOffset" : [0, 0],
"feetOffset" : [0, -8],
"targetNoticeDistance" : 20,
"initialPauseTime" : 2,
"idleBlinkIntervalRange" : [4, 5],
"attackTargetHoldTime" : 5.0
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB