Post Title

Post Content

Testing content

come on phone, lets reload this pag..dsadasdgadae

Image

Video

Temp removed video to avoid any possible eating of bandwidth. Will probably avoid using video with maybe embed's from youtube if I can figure out a way to do that nicely.

Originally I was messing with each post individually.. but now I think it's best to setup a template to make sure I can keep consistency with layout and design.

Below is some example code (pulled directly from a Lua project of mine) so I can decide on a good highlight scheme.


local orion = require("orion")

if orion == nil then
    return nil
end

local source = {
    label = "spawn",
    x = 0,
    y = 0,
    ship_color = nil,
    radius = {
        inner = 0,
        outer = 1,
        speed = 0,
        max = 100,
    },
    alpha = 1,
    master = nil,
    vector_list = {},
    spawn = false,
    input = nil, -- filled in via load event
    mask = nil,
}

function source:event_load(event_data)
    local sound = GLOBAL.sound.spawn:clone()
    sound:play()
    local data = event_data.data
    self.x = data.x
    self.y = data.y
    self.master = data.master
    self.ship_color = data.color
    self.mode = data.mode
    self.spawn = data.spawn
    self.input = data.input

    local circle = {
        x = 0,
        y = 0,
        r = self.radius.max,
    }

    self.mask = orion.collision.mask_add("circle",circle,event_data.instance,"spawn")
    orion.collision.link(self.mask,GLOBAL.collision.layer,false,{"spawn","pulse","laser","pull"})
    orion.collision.mask_update(self.mask,self.x,self.y)
    --orion.instance.collision_mask_update(event_data.instance,self.x,self.y)
end

function source:event_unload(event_data)
    orion.collision.mask_remove(self.mask)
end

function source:event_collision(event_data)
    local other = event_data.collision.other
    local os = other.source
end

function source:event_update(event_data)
    if self.radius.inner < self.radius.max-10 then
        for i = 1, 4 do
            self:add_vector()
        end
    end

    local remove = {}

    for j, v in ipairs(self.vector_list) do
        v.length = v.length * love.math.random(2)
        if v.length > self.radius.outer then
            v.length = self.radius.outer
        end
        v.color[4] = v.color[4] - 0.01
        if v.color[4] < 0 then
            orion.list.add(remove,v)
        end
    end

    for j, v in ipairs(remove) do
        orion.list.remove(self.vector_list,v)
    end

    if self.radius.outer < self.radius.max then
        self.radius.outer = self.radius.outer + self.radius.speed
    elseif self.radius.inner < self.radius.max-10 then
        if self.radius.inner == 0 then
            if self.spawn then
                local send = {
                    master = self.master,
                    color = self.ship_color,
                    input = self.input,
                }
                orion.instance.add(GLOBAL.object.ship,nil,send) -- spawn spaceship
            end
            self.radius.speed = 1
        end
        self.radius.inner = self.radius.inner + self.radius.speed
    end
    self.radius.speed = self.radius.speed + 0.5

    if #self.vector_list == 0 then
        orion.instance.remove(event_data.instance)
    end
end

function source:event_draw(event_data)
    local x, y
    love.graphics.setBlendMode("add")
    love.graphics.setLineWidth(2)
    for i, v in ipairs(self.vector_list) do
        x, y = orion.math.vector_xy(v.length,v.direction)
        love.graphics.setColor(v.color)
        love.graphics.line(self.x,self.y,self.x+x,self.y+y)
    end
    love.graphics.setLineWidth(1)
    love.graphics.setBlendMode("alpha")
    love.graphics.setColor({ 1,1,1,1})

    if self.radius.inner > 0 then
        love.graphics.setColor({0,0,0,1})
        love.graphics.circle("fill",self.x,self.y,self.radius.inner)
    end
    love.graphics.setColor({1,1,1,1})
    if GLOBAL.bounding then
        orion.collision.mask_draw(self.mask,"line",GLOBAL.bounding)
        --orion.instance.collision_mask_draw("line",event_data.instance,GLOBAL.bounding)
    end
end

function source:add_vector()
    local vector = {
        length = love.math.random(),
        direction = love.math.random(360),
        color = { love.math.random(), love.math.random(), love.math.random(), 1 },
        --color = { 1, 0.5, 0, 1},
    }

    orion.list.add(self.vector_list,vector)
end

return orion.object.add(source,"spawn")
      

Some example follow text