Page 1 of 1
Game without a title (yet)
Posted: Tue Mar 03, 2015 12:40 pm
by martincohen
Hey guys,
this is a first shitty prototype of a game I'm working on:
I've set some challenges in this one. I'm not using love.physics, but instead I'm implementing collisions and "physics" myself (by learning from
Handmade Hero series). It's actually my first game in Love2D
I'm quite happy how the shake and explosions feel, even though both of them were just a 5-minute implementation.
Obey!
Re: Game without a title (yet)
Posted: Tue Mar 03, 2015 4:56 pm
by davisdude
Looks good! And thanks for that link! Very interesting stuff... although I think I'll stick with a less "entirely" handmade approach and use LÖVE.
Re: Game without a title (yet)
Posted: Tue Mar 03, 2015 6:03 pm
by Germanunkol
It doesn't look shitty at all. Looks nice already! I especially like the screen-shake, although it might be too much if it always shakes that much, maybe make it shake less for normal shots and only increase the shake amount when you're close to an explosion or when "heavy" shots are fired?
Re: Game without a title (yet)
Posted: Tue Mar 03, 2015 7:01 pm
by martincohen
@davisdude Thank you! Yeah, I wanted to do that too (originally in Unity), but then I wanted to have more control and less reading manuals or guessing how closed-source stuff works. So I firt implemented the platform layer (in a separate project) to see how it works, then I went for Love2D to use that as my base (as I love Lua). Now I'm doing the "game" stuff in Love2D, just to learn it, before I choose whether to go to bump.lua or love.physics, or even stay with the code I currently have.
@Germanunkol Thank you! Yeah, the shake needs a lot of tuning (at least to not shake that often). Good idea with the distance to explosion! I'll give that a try!
Re: Game without a title (yet)
Posted: Wed Mar 04, 2015 1:26 pm
by nfey
Looks great
. The screen shake does indeed seem over-used, I agree with Germanunkol's advice.
Are you looking at refining the gameplay further or are you just using this to get the basics in place?
Re: Game without a title (yet)
Posted: Wed Mar 04, 2015 4:50 pm
by martincohen
@nfey: Thanks a lot! <3
nfey wrote:Are you looking at refining the gameplay further or are you just using this to get the basics in place?
I'm just putting "something" together to get the engine-layer working along actually learning how to do things. So I smashed a few basic things I know I'll need together and now I'm "compressing" down to a compact engine lib. I'll refine the details after the base is done. I plan to make this into (at least a tiny one-level) game, just to have something finished and polished as much as I can.
The shake was bugging me for a few days, so I had to give it a try. Now it's done just by
And it'll shake for a short period of time starting at amplitude of 8 which gradually lowers over a few ms back to 0. So that's all there is for that one. How are you doing it?
Re: Game without a title (yet)
Posted: Wed Mar 04, 2015 9:47 pm
by megalukes
Amazing concept. The shaking camera was really well made. I liked those explosions you made using pentagons, I've been trying to do something like those for a while now
.
Really looking forward to it. Good luck!
Re: Game without a title (yet)
Posted: Thu Mar 05, 2015 1:42 am
by martincohen
@megalukes: Thank you! I'm glad you like it! The explosions are really basic stuff. Here's the code for the entire entity. It's a bit hacky (especially the math.min/max part) but at least you'll get the idea, if you are interested:
Code: Select all
local Timer = require('util.timer')
local C = require('constants')
local Aggregate = require('game.aggregate')
local Entity = require('component.entity')
local Spatial = require('component.spatial')
Explosion = {
type = C.ENTITY_TYPE_EFFECT,
ex = {},
timer = Timer.new()
}
function Explosion:init()
self.data.flags:unset(C.ENTITY_FLAG_COLLIDABLE)
end
function Explosion:new(x, y)
self.x = x
self.y = y
for i = 1, 8 do
table.insert(self.ex, {
x = math.random(-15, 15),
y = math.random(-15, 15),
s = 1,
max_s = math.random(2, 20)
})
end
G.camera.shake = 8
self.timer:start()
return self
end
function Explosion:update(dt)
if self.timer:elapsed() > 1 then
G.world:removeEntity(self)
return
end
for _, ex in ipairs(self.ex) do
ex.s = ex.s * math.max(0.9, math.min(1, 50 * dt))
end
end
function Explosion:drawOne(e)
LG.setColor(255, 255 * e.s, 255 * e.s)
LG.circle('fill', self.x + e.x, self.y + e.y, e.s * e.max_s, 7)
end
function Explosion:draw()
for _, ex in ipairs(self.ex) do
if ex ~= nil then
self:drawOne(ex)
end
end
end
return Aggregate:declare(
Entity(),
Spatial,
Explosion)