summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/controllers/fish.moon4
-rw-r--r--src/islandgen.moon17
-rw-r--r--src/main.lua1
-rw-r--r--src/menu/main.moon4
-rw-r--r--src/menu/settings.moon16
-rw-r--r--src/player.moon8
-rw-r--r--src/preload.lua2
-rw-r--r--src/spawn_fish.moon4
-rw-r--r--src/ui.moon6
-rw-r--r--src/window.moon2
-rw-r--r--src/world.moon8
11 files changed, 30 insertions, 42 deletions
diff --git a/src/controllers/fish.moon b/src/controllers/fish.moon
index 3c829f3..dc3b1e9 100644
--- a/src/controllers/fish.moon
+++ b/src/controllers/fish.moon
@@ -7,7 +7,7 @@ controller = {}
class FishControllerComponent extends ecs.Component
new: () =>
- print("Fish controller started")
+ --print("Fish controller started")
@node = am.group!
join: (entity) =>
super(entity)
@@ -74,6 +74,6 @@ class FishControllerComponent extends ecs.Component
@net.properties.next_loc_time = world.sync_time!
--@net.properties.next_loc = @net.properties.pos + vec2(0,1)
--@net.properties.next_loc_time = world.sync_time!
- print("Picking next location, it was ", @net.properties.next_loc)
+ --print("Picking next location, it was ", @net.properties.next_loc)
{:FishControllerComponent}
diff --git a/src/islandgen.moon b/src/islandgen.moon
index 1e5b83d..dd9473b 100644
--- a/src/islandgen.moon
+++ b/src/islandgen.moon
@@ -21,12 +21,12 @@ sides = 4
gen.generate = (seed) ->
rg = rng.generator(seed)
normal = (avg, std) ->
- print("normal with", avg, std)
+ --print("normal with", avg, std)
rg1, rg2 = rg(),rg()
- print("rgs:",rg1, rg2)
+ --print("rgs:",rg1, rg2)
-- Box-Muller transform
bm = math.sqrt(-2 * math.log(rg1)) * math.cos(2 * math.pi * rg2)
- print("bm was:",bm)
+ --print("bm was:",bm)
-- Box-Muller gives us std = e^-0.5 , avg = 0
((bm / math.exp(-1/2)) * std) + avg
shoreline = {}
@@ -50,15 +50,15 @@ gen.generate = (seed) ->
avg_direction = ((i-1)/sides) * (2 * math.pi)
std_direction = math.pi / 6
rng_direction = normal(avg_direction, std_direction)
- print("rng_direction ended up being:", rng_direction)
+ --print("rng_direction ended up being:", rng_direction)
point = shoreline[#shoreline] + vec2(math.cos(rng_direction) * point_distance, math.sin(rng_direction) * point_distance)
shoreline[#shoreline + 1] = point
- print("point:", point)
- print("prev:",aabb[aabb_sides[i][3]])
+ --print("point:", point)
+ --print("prev:",aabb[aabb_sides[i][3]])
aabb[aabb_sides[i][3]] = aabb_sides[i][2](aabb[aabb_sides[i][3]],point[aabb_sides[i][1]])
- print("Generated shoreline:",shoreline)
- print("And aabb box:" ,aabb)
+ --print("Generated shoreline:",shoreline)
+ --print("And aabb box:" ,aabb)
-- Now that we have the shorline, generate the geometry
-- every point after the first needs to generate 2 triangles, 6 vertexes, each vertex is a vec3, 3 floats, 4 bytes per float
geom = am.buffer(((n_points * 2) - 4) * 6 * 3 * 4) -- 4 corners only get 1 triangle
@@ -189,7 +189,6 @@ class WaterGraphicsComponent extends world.GraphicsComponent
normal_view[24] = vec2(uv.s2,uv.t1)
setup: (node) =>
bind = node("bind")
- print("Found bind node:",node)
for k,v in pairs(color.am_lake_color)
bind[k] = v
bind.water = 2
diff --git a/src/main.lua b/src/main.lua
index 7470724..d971d5e 100644
--- a/src/main.lua
+++ b/src/main.lua
@@ -22,7 +22,6 @@ pp:append(stars)
win.scene:append(pp)
local ui = require("ui")
-print("ui was", ui)
win.scene:append(ui.node)
local router = require("router")
diff --git a/src/menu/main.moon b/src/menu/main.moon
index ee33dc9..f7ead73 100644
--- a/src/menu/main.moon
+++ b/src/menu/main.moon
@@ -14,6 +14,7 @@ buttons_data = {
{
text: "Start"
on: () =>
+ @.text = "Loading..."
menu.destroy!
require("worldgen")
--require("menu.join").initalize!
@@ -22,12 +23,9 @@ buttons_data = {
menu.initalize = () ->
starty = -200
for i = starty, ((#buttons_data-1) * (64 + 32)) + starty, 64 + 32
- print("making button", #buttons + 1)
buttons[#buttons + 1] = ui.button(-200,i,400,64,buttons_data[#buttons + 1].text)
buttons[#buttons].on = buttons_data[#buttons].on
- print("intalize")
-
menu.destroy = () ->
for button in *buttons
ui.delete(button)
diff --git a/src/menu/settings.moon b/src/menu/settings.moon
index 1f21cc3..b3be124 100644
--- a/src/menu/settings.moon
+++ b/src/menu/settings.moon
@@ -7,6 +7,13 @@ menu = {}
buttons = {}
buttons_data = {
{
+ text: "Done"
+ on: () =>
+ menu.destroy!
+ require("menu.main").initalize!
+ type: "button"
+ }
+ {
text: "Streamer"
on: (depressed) =>
--error("depressed:" .. depressed)
@@ -23,13 +30,6 @@ buttons_data = {
type: "slider"
}
- {
- text: "Done"
- on: () =>
- menu.destroy!
- require("menu.main").initalize!
- type: "button"
- }
}
menu.initalize = () ->
starty = -200
@@ -39,7 +39,7 @@ menu.initalize = () ->
buttons[#buttons + 1] = ui.checkbox(-200,i,400,64,button_data.text)
buttons[#buttons].on = button_data.on
elseif button_data.type == "slider"
- buttons[#buttons + 1] = ui.textbox(-200,i,400,64,settings.volume)
+ buttons[#buttons + 1] = ui.textbox(-200,i,400,64,settings.volume, "volume")
buttons[#buttons].on = button_data.on
elseif button_data.type == "button"
buttons[#buttons + 1] = ui.button(-200,i,400,64,button_data.text)
diff --git a/src/player.moon b/src/player.moon
index 04bb146..f43407c 100644
--- a/src/player.moon
+++ b/src/player.moon
@@ -88,7 +88,7 @@ class PlayerLineGraphicComponent extends world.GraphicsComponent
@action("bobbersfx", am.play(19726308, false, 1, settings.volume))
else
@action("bobbersfx", am.play(82979201, false, 1, settings.volume))
- print("Should create bobber")
+ --print("Should create bobber")
elseif not s.net.properties.casted and entity.bobber ~= nil
entity.bobber\destroy!
@action("bobberretract", am.play(57368801, false, 1, settings.volume))
@@ -207,7 +207,7 @@ class PlayerPredictedComponent extends ecs.PredictedComponent
@ent.bobber and @ent.bobber\check!
})
- print("Right after creation, properties is",@properties)
+ --print("Right after creation, properties is",@properties)
@node = am.group!
join: (entity) =>
@ent = entity
@@ -224,7 +224,7 @@ class PlayerPredictedComponent extends ecs.PredictedComponent
-- Step sound effect
land = world.level.on_land(@properties.pos)
if am.current_time! - @last_step > (step_time * (land and 1 or 0.75)) and math.length(@properties.vel) > 0
- print("Step playing")
+ --print("Step playing")
if land
@node\action("stepsfx", am.play(60861008 + math.random(10) * 100, false, 1, settings.volume))
else
@@ -256,7 +256,7 @@ class ProtoPlayer extends ecs.Entity
fish_caught: 0
})
lc = PlayerLineGraphicComponent("line")
- print("Protoplayer created")
+ --print("Protoplayer created")
super("test",{graphic:gc,net:nc,controller:cc,pred:pc,line:lc})
{:Player, :ProtoPlayer}
diff --git a/src/preload.lua b/src/preload.lua
index 5b4034d..64b5314 100644
--- a/src/preload.lua
+++ b/src/preload.lua
@@ -43,7 +43,7 @@ Display where print statements are comming from
local oldprint = print
print = function(...)
- oldprint(...)
+ error("Print")
oldprint(debug.traceback())
end
]]
diff --git a/src/spawn_fish.moon b/src/spawn_fish.moon
index 58c13d9..1e5628f 100644
--- a/src/spawn_fish.moon
+++ b/src/spawn_fish.moon
@@ -180,8 +180,8 @@ class FishPredictedComponent extends ecs.PredictedComponent
@cc = entity\get("control")
@pc = entity\get("phys")
@ent = entity
- print("Got graphic component:",@gc, @gc.node)
- print("And my node is", @node)
+ --print("Got graphic component:",@gc, @gc.node)
+ --print("And my node is", @node)
@gc.node\append(@node)
s = @
@node\action(() =>
diff --git a/src/ui.moon b/src/ui.moon
index 3c45b80..862bec0 100644
--- a/src/ui.moon
+++ b/src/ui.moon
@@ -86,8 +86,8 @@ ui.node = am.group!
has_fire = (obj) ->
assert(obj.fire, obj.__class.__name .. " doesn't have a .fire method")
-ui.dbg = am.translate(0,0)\append(am.circle(vec2(0,0),5,vec4(0,0,0,1)))\append(am.text("Hello, world!"))
-ui.node\append(ui.dbg)
+--ui.dbg = am.translate(0,0)\append(am.circle(vec2(0,0),5,vec4(0,0,0,1)))\append(am.text("Hello, world!"))
+--ui.node\append(ui.dbg)
ui.node\action(() ->
pos = win\mouse_position()
@@ -98,7 +98,7 @@ ui.node\action(() ->
am.eval_js("CONT.loop()")
cont_state = am.eval_js("CONT.last_state")
-- Debugging for mouse position:
- ui.dbg.position2d = pos
+ --ui.dbg.position2d = pos
mo_tbl =
event: "mouse_over"
data: pos
diff --git a/src/window.moon b/src/window.moon
index 367cd1c..ddd56b2 100644
--- a/src/window.moon
+++ b/src/window.moon
@@ -1,7 +1,7 @@
color = require("color")
-- Special file to hold the window, no dependencies!
win = am.window{
- title: "ggj25"
+ title: "Night Fishing"
width: 1280
height: 720
clear_color: color.am_color.background
diff --git a/src/world.moon b/src/world.moon
index d622351..5c76187 100644
--- a/src/world.moon
+++ b/src/world.moon
@@ -8,7 +8,6 @@ shim = require("shader_shim")
log = require("log")
MAX_LAMPS = 8
-print("hc:", hc)
--Use a collider to decide what to render
x = {
world_e: ecs.Entity(1)
@@ -59,7 +58,6 @@ x.level.lamps_on_screen = () ->
return lamps
lamps
x.fromscreen = (pos) ->
- print("fromscreen pos is", pos)
-- convert creen pixel coords to world xy coords
localx = (pos.x * (win.width / win.height) * 4) / (win.width + 1)
localy = (pos.y * 1 * 4) / win.height
@@ -79,7 +77,6 @@ class Bubble
@wrap = 1
new: (pos) =>
bubble_view[@@wrap] = vec4(pos.x, pos.y, -1, am.current_time!)
- print("Bubble created")
class PhysicsComponent extends ecs.Component
new: (name, properties, shape, args) =>
@@ -90,7 +87,6 @@ class PhysicsComponent extends ecs.Component
super(name, properties)
hc = x.level.physics_world
table.insert(args,1,hc)
- print("Creating a physics component with", args)
@shape = hc[shape](unpack(args))
@shape.component = @
join: (entity) =>
@@ -104,14 +100,12 @@ class PhysicsComponent extends ecs.Component
class GraphicsComponent extends ecs.Component
new: (name, properties) =>
- print("Got name", name, "and properties", properties)
@node = am.group!
--assert(properties and properties.node , "Failed to find node for graphics component")
super(name, properties)
--x.node\append(properties.node)
join: (entity) =>
buf_size = @buf_size!
- print("Creating entity " .. entity.id .. " with graphic component with " .. buf_size .. " vertexes")
@geom_buffer = am.buffer(buf_size * 3 * 4)\view("vec3") -- 3 floats per vertex, 4 bytes per float
@norm_buffer = am.buffer(buf_size * 2 * 4)\view("vec2") -- 2 floats per uv, 4 bytes per float
@populate_buf(@geom_buffer, @norm_buffer)
@@ -147,7 +141,6 @@ class GraphicsComponent extends ecs.Component
am.bind(binds)\append(
am.draw("triangles")
)))))
- print("graphic node created for",@,@node)
component = @
@node\action(() =>
bind = component.node("bind")
@@ -174,7 +167,6 @@ class GraphicsComponent extends ecs.Component
)
if @setup
@setup(@node)
- print("Appending ", @node, " to the scene")
x.node\append(@node)
leave: () =>
x.node\remove(@node)