add current stuff yeha
This commit is contained in:
parent
2744423cda
commit
ae65683e44
81 changed files with 962 additions and 0 deletions
60
constructors.lua
Normal file
60
constructors.lua
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
require 'const'
|
||||
|
||||
local self = {}
|
||||
|
||||
function self.fish(x, y)
|
||||
local fish = {
|
||||
x = x,
|
||||
y = y,
|
||||
size = 0, -- 0 for small, 1 for medium, 2 for big, 3 for king
|
||||
eattimer = 0 + math.random() * 2, -- starts out hungry, with a 2s delay
|
||||
|
||||
lifetime = 0,
|
||||
|
||||
eases = {
|
||||
|
||||
},
|
||||
render = {
|
||||
x = 0,
|
||||
y = 0,
|
||||
prevx = 0,
|
||||
prevy = 0,
|
||||
turn = 0,
|
||||
swim = 0,
|
||||
angle = 0,
|
||||
xspeed = 0,
|
||||
yspeed = 0,
|
||||
eattimer = 1,
|
||||
hungry = 0,
|
||||
}
|
||||
}
|
||||
|
||||
for i = 1, FISH_SPLINE_QUALITY do
|
||||
table.insert(fish.eases, { -- we insert a fake ease that ends instantly and just hope the update loop replaces it with a valid, random one
|
||||
x = x,
|
||||
y = y,
|
||||
fromx = x,
|
||||
fromy = y,
|
||||
a = 1,
|
||||
speed = 1
|
||||
})
|
||||
end
|
||||
|
||||
return fish
|
||||
end
|
||||
|
||||
function self.food(x, y, type)
|
||||
local food = {
|
||||
x = x,
|
||||
y = y,
|
||||
speed = 0.2,
|
||||
time = math.random(),
|
||||
deathtimer = 0,
|
||||
type = 1,
|
||||
goal = 0 -- assigns 0 as the fish so that hopefully the update loop replaces it with a valid, random one
|
||||
}
|
||||
|
||||
return food
|
||||
end
|
||||
|
||||
return self
|
||||
Loading…
Add table
Add a link
Reference in a new issue