so my chaser is basically a zombie who chases you whenever u get within the trigger zone
PROBLEMS FACING
-zombie sprite looks super glitch when it is moving towards the player while on the same X coordinates
(same with same Y but i know its because it is neither > or < for the script to respond)
IMPORTANT POINT : ONLY HAPPENS WHEN CHASER.X == HERO.X SAME X AXIS PLANE
cant send video, screenshot is one frame so it cant capture the slight shake of the sprite just imagine two zombies of same animation(playing not like smashing start playing) slightly different postiton flipping back and forth really quickly
-is there a way to get rid of the grip i get when i try to walk in southwest when there is a southern wall and pushing against the wall because this is causing the zombie and i to stick on the wall
INFORMATION
zombie has idle,left,right animation normally i use right for up and left for down too lazy(this time i did not add react to up and down because of < and >
all my moving scripts are edits of the walking astronaut one
SCRIPTS
THIS IS THE ZOMBIE_MOVE SCRIPT!!!
url ------ send from zombie_move script
function chase(self)
--if there is better ways to slow down the chaser plz let me know uwu
if self.chase == true then
msg.post("/hero#hero_enemy", "triggered", {url = self.url})
elseif self.chase == false then
self.enemy = nil
msg.post("#sprite", "play_animation", { id = hash("idle") })
end
end
function init(self)
self.dir = vmath.vector3()
self.enemy = nil
self.current_anim = nil
self.speed = 300
--msg.post("@system:", "toggle_physics_debug")
self.chase = false
self.url = msg.url()
timer.delay(0.25, true, chase)
end
function update(self, dt)
self.anim = hash("idle")
self.pos = go.get_position()
if self.enemy ~= nil then
if self.enemy.y > self.pos.y then
self.dir.y = self.dir.y + 1
if self.enemy.x > self.pos.x then
self.dir.x = self.dir.x + 1
self.anim = hash("right")
elseif self.enemy.x < self.pos.x then
self.dir.x = self.dir.x - 1
self.anim = hash("left")
end
elseif self.enemy.y < self.pos.y then
self.dir.y = self.dir.y - 1
if self.enemy.x > self.pos.x then
self.dir.x = self.dir.x + 1
self.anim = hash("right")
elseif self.enemy.x < self.pos.x then
self.dir.x = self.dir.x - 1
self.anim = hash("left")
end
end
if vmath.length_sqr(self.dir) > 1 then
self.dir = vmath.normalize(self.dir)
end
go.set_position(self.pos + self.dir * self.speed * dt)
end
-- animate
if self.anim ~= self.current_anim then
msg.post("#sprite", "play_animation", { id = self.anim })
print(self.anim)
self.current_anim = self.anim
end
-- done animating
self.dir = vmath.vector3()
end
function on_message(self, message_id, message, sender)
if message_id == hash("returned_position") then
self.enemy = message.pos
elseif message_id == hash("trigger_response") then
if message.enter then
self.chase = true
else
self.chase = false
end
end
end
line``````````````````````````````````````````````
THIS IS THE HERO_ENEMY SCRIPT!!!!!!!!
url ------ /hero#hero_enemy
function on_message(self, message_id, message, sender)
if message_id == hash("triggered") then
local reciever_url = message.url
self.pos = go.get_position()
msg.post(reciever_url, "returned_position", { pos = self.pos })
end
end
**PLEASE HEPPPP wOwOwOw **
BTW the shortcut icon for the forum has a white box around it and it is not looking good and the dashboard shortcut icon is kinda pixalated