mirror of
https://github.com/bvanroll/Love2d.git
synced 2025-08-29 03:52:49 +00:00
organizing folders
This commit is contained in:
55
HomeMadeLibs/Characters.lua
Normal file
55
HomeMadeLibs/Characters.lua
Normal file
@@ -0,0 +1,55 @@
|
||||
player = {
|
||||
properties = {
|
||||
name = "PlayerName",
|
||||
sprite = "NaN"
|
||||
},
|
||||
size = {
|
||||
width = 5,
|
||||
height = 10
|
||||
},
|
||||
physics = {
|
||||
gravity = false,
|
||||
rate = 0.1,
|
||||
grate = 0.98,
|
||||
pos = {
|
||||
x = 50,
|
||||
y = 50,
|
||||
z = 1
|
||||
},
|
||||
vel = {
|
||||
x = 1,
|
||||
y = 1,
|
||||
z = 1
|
||||
},
|
||||
Addvel = function(self, vx, vy, vz)
|
||||
self.vel.x = self.vel.x + vx
|
||||
self.vel.y = self.vel.y + vy
|
||||
self.vel.z = self.vel.z + vz
|
||||
end,
|
||||
Stopvel = function(self)
|
||||
self.vel.x = 1
|
||||
self.vel.y = 1
|
||||
self.vel.z = 1
|
||||
end,
|
||||
Update = function(self)
|
||||
self.pos.x = self.pos.x * self.vel.x
|
||||
self.pos.y = self.pos.y * self.vel.y
|
||||
self.pos.z = self.pos.z * self.vel.z
|
||||
if(self.gravity) then self.vel.y = self.vel.y + grate end
|
||||
if(self.vel.x < 1) then self.vel.x = self.vel.x + self.rate end
|
||||
if(self.vel.y < 1) then self.vel.y = self.vel.y + self.rate end
|
||||
if(self.vel.z < 1) then self.vel.z = self.vel.z + self.rate end
|
||||
if(self.vel.x > 1) then self.vel.x = self.vel.x - self.rate end
|
||||
if(self.vel.y > 1) then self.vel.y = self.vel.y - self.rate end
|
||||
if(self.vel.z > 1) then self.vel.z = self.vel.z - self.rate end
|
||||
end,
|
||||
SetPosition = function(self, x, y, z)
|
||||
self.pos.x = x
|
||||
self.pos.y = y
|
||||
self.pos.z = z
|
||||
self.vel.x = 1
|
||||
self.vel.y = 1
|
||||
self.vel.z = 1
|
||||
end
|
||||
}
|
||||
}
|
28
HomeMadeLibs/balls.lua
Normal file
28
HomeMadeLibs/balls.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
balls = {
|
||||
xcors = {},
|
||||
ycors = {},
|
||||
dia = {},
|
||||
segs = {},
|
||||
spesh = {},
|
||||
mov = {},
|
||||
spd = {},
|
||||
tresh = {},
|
||||
tmptresh = {},
|
||||
update = function(self, val, len)
|
||||
for i,v in ipairs(self.dia) do
|
||||
if (val > self.tresh[i])then
|
||||
self.tresh[i] = self.tresh[i] +self.tmptresh[i]
|
||||
self.dia[i] = math.sin((val/self.spesh[i]) * math.pi) * len
|
||||
if self.mov[i] >= .5 then
|
||||
self.xcors[i] = self.xcors[i] + math.random(-1 * self.spd[i], self.spd[i])
|
||||
self.ycors[i] = self.ycors[i] + math.random(-1 * self.spd[i], self.spd[i])
|
||||
if self.xcors[i] > wwidth then self.xcors[i] = wwidth end
|
||||
if self.ycors[i] > wheight then self.ycors[i] = wheight end
|
||||
if self.xcors[i] < 0 then self.xcors[i] = 0 end
|
||||
if self.ycors[i] < 0 then self.ycors[i] = 0 end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
11
MouseExperiments/main.lua
Normal file
11
MouseExperiments/main.lua
Normal file
@@ -0,0 +1,11 @@
|
||||
function love.load(arg)
|
||||
-- body...
|
||||
end
|
||||
|
||||
function love.update(dt)
|
||||
-- body...
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
-- body...
|
||||
end
|
47
experimentingSinCosinTan/love.conf
Normal file
47
experimentingSinCosinTan/love.conf
Normal file
@@ -0,0 +1,47 @@
|
||||
function love.conf(t)
|
||||
t.identity = nil -- The name of the save directory (string)
|
||||
t.appendidentity = false -- Search files in source directory before save directory (boolean)
|
||||
t.version = "11.0" -- The LÖVE version this game was made for (string)
|
||||
t.console = true -- Attach a console (boolean, Windows only)
|
||||
t.accelerometerjoystick = true -- Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean)
|
||||
t.externalstorage = false -- True to save files (and read from the save directory) in external storage on Android (boolean)
|
||||
t.gammacorrect = false -- Enable gamma-correct rendering, when supported by the system (boolean)
|
||||
|
||||
t.audio.mixwithsystem = true -- Keep background music playing when opening LOVE (boolean, iOS and Android only)
|
||||
|
||||
t.window.title = "Untitled" -- The window title (string)
|
||||
t.window.icon = nil -- Filepath to an image to use as the window's icon (string)
|
||||
t.window.width = 800 -- The window width (number)
|
||||
t.window.height = 600 -- The window height (number)
|
||||
t.window.borderless = true -- Remove all border visuals from the window (boolean)
|
||||
t.window.resizable = false -- Let the window be user-resizable (boolean)
|
||||
t.window.minwidth = 1 -- Minimum window width if the window is resizable (number)
|
||||
t.window.minheight = 1 -- Minimum window height if the window is resizable (number)
|
||||
t.window.fullscreen = false -- Enable fullscreen (boolean)
|
||||
t.window.fullscreentype = "desktop" -- Choose between "desktop" fullscreen or "exclusive" fullscreen mode (string)
|
||||
t.window.vsync = 1 -- Vertical sync mode (number)
|
||||
t.window.msaa = 0 -- The number of samples to use with multi-sampled antialiasing (number)
|
||||
t.window.display = 1 -- Index of the monitor to show the window in (number)
|
||||
t.window.highdpi = false -- Enable high-dpi mode for the window on a Retina display (boolean)
|
||||
t.window.x = nil -- The x-coordinate of the window's position in the specified display (number)
|
||||
t.window.y = nil -- The y-coordinate of the window's position in the specified display (number)
|
||||
|
||||
t.modules.audio = true -- Enable the audio module (boolean)
|
||||
t.modules.data = true -- Enable the data module (boolean)
|
||||
t.modules.event = true -- Enable the event module (boolean)
|
||||
t.modules.font = true -- Enable the font module (boolean)
|
||||
t.modules.graphics = true -- Enable the graphics module (boolean)
|
||||
t.modules.image = true -- Enable the image module (boolean)
|
||||
t.modules.joystick = true -- Enable the joystick module (boolean)
|
||||
t.modules.keyboard = true -- Enable the keyboard module (boolean)
|
||||
t.modules.math = true -- Enable the math module (boolean)
|
||||
t.modules.mouse = true -- Enable the mouse module (boolean)
|
||||
t.modules.physics = true -- Enable the physics module (boolean)
|
||||
t.modules.sound = true -- Enable the sound module (boolean)
|
||||
t.modules.system = true -- Enable the system module (boolean)
|
||||
t.modules.thread = true -- Enable the thread module (boolean)
|
||||
t.modules.timer = true -- Enable the timer module (boolean), Disabling it will result 0 delta time in love.update
|
||||
t.modules.touch = true -- Enable the touch module (boolean)
|
||||
t.modules.video = true -- Enable the video module (boolean)
|
||||
t.modules.window = true -- Enable the window module (boolean)
|
||||
end
|
@@ -11,6 +11,20 @@ nStraal = 0
|
||||
|
||||
|
||||
|
||||
--- shaders ...
|
||||
|
||||
local shader_code = [[
|
||||
extern number eff;
|
||||
vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ){
|
||||
vec4 pixel = Texel(texture, texture_coords); // this is the current pixel color
|
||||
number average = (pixel.r + pixel.b + pixel.g) / 3.0;
|
||||
pixel.r = pixel.r + (average-pixel.r) *eff;
|
||||
pixel.g = pixel.g + (average-pixel.g) *eff;
|
||||
pixel.b = pixel.b + (average-pixel.b) *eff;
|
||||
return pixel * color;
|
||||
}
|
||||
]]
|
||||
|
||||
|
||||
|
||||
--- objects ...
|
||||
@@ -110,6 +124,7 @@ balls = {
|
||||
|
||||
--loadVars
|
||||
function love.load()
|
||||
firstshader = love.graphics.newShader(shader_code)
|
||||
r = 1
|
||||
g = 1
|
||||
b = 1
|
||||
@@ -142,6 +157,7 @@ end
|
||||
|
||||
--- updateVars
|
||||
function love.update(dt)
|
||||
print("FRAME")
|
||||
player.physics:Update()
|
||||
x = x + 1
|
||||
if (x > wwidth) then
|
||||
@@ -152,8 +168,9 @@ function love.update(dt)
|
||||
g = math.sin((bdt / 10) * math.pi)
|
||||
b = math.cos((bdt / 100)* math.pi)
|
||||
balls:update(bdt, nStraal)
|
||||
firstshader:send("eff", math.sin((love.mouse.getX()+love.mouse.getY()) * math.pi))
|
||||
bdt = bdt + dt
|
||||
print(bdt)
|
||||
--print(bdt)
|
||||
---[[
|
||||
---[[print("r: "..r)
|
||||
---[[ print("g: "..g)
|
||||
@@ -176,12 +193,17 @@ function love.update(dt)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function love.keypressed( key )
|
||||
print("key "..key.." has been pressed")
|
||||
if key == "escape" then
|
||||
love.event.quit(1)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
---darwFunction
|
||||
function love.draw()
|
||||
love.graphics.setShader(firstshader)
|
||||
love.graphics.setBlendMode("alpha", "premultiplied")
|
||||
|
||||
--print("height = " .. wheight .. "\nwidth = " .. wwidth .. "\nx = " .. x .. "\ny = " .. y .. "\nframes: " .. bdt)
|
Reference in New Issue
Block a user