20 lines
No EOL
668 B
Lua
20 lines
No EOL
668 B
Lua
function wander(object, dt)
|
|
if object.x > object.attributes.wanderpoint + 2 or object.x < object.attributes.wanderpoint - 2 then
|
|
object.bools.isWalking = true
|
|
if object.x < object.attributes.wanderpoint then
|
|
object.physics.velocityX = 1
|
|
else
|
|
object.physics.velocityX = -1
|
|
end
|
|
else
|
|
object.attributes.wanderpoint = math.random(0, window.x)
|
|
end
|
|
end
|
|
|
|
function sayHello(object, dt)
|
|
object.attributes.time_spoken = object.attributes.time_spoken + dt
|
|
if object.attributes.time_spoken > 2 then
|
|
object.bools.isInteracting = false
|
|
object.attributes.time_spoken = 0
|
|
end
|
|
end |