Connection Paint

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
Mkalo
Prole
Posts: 11
Joined: Thu Dec 29, 2011 11:54 pm

Connection Paint

Post by Mkalo »

Image

A picture is worth a thousand words.

Click to able or disable connections.

If you like change the configurations of the game and put it full screen :) I like that...
Attachments
Connection Paint.love
(915 Bytes) Downloaded 161 times
Bomberman in LÖVE:
http://migre.me/7Beiu
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: Connection Paint

Post by MarekkPie »

I like it. I attempted to make the check 2 squares instead of 1 and almost got it, but then some stupid bugs got in the way and I realized I should be debugging my game instead. :)
Mkalo
Prole
Posts: 11
Joined: Thu Dec 29, 2011 11:54 pm

Re: Connection Paint

Post by Mkalo »

Hmm there is, i think.
Attachments
Connection Paint 2.love
(991 Bytes) Downloaded 135 times
Bomberman in LÖVE:
http://migre.me/7Beiu
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: Connection Paint

Post by MarekkPie »

I was thinking more along the lines of something you could change via a menu. Set the size of the spatial hash (I think that's the name for what you are doing, but maybe not), then the game will build the "dirs".

Something like:

Code: Select all

for i = -size, size do
  for j = -size, size do
    table.insert(dirs, {i,j})
  end
end
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Connection Paint

Post by Nixola »

I've got an Intel graphic card and I can't see 1-pixel-wide horizontal or vertical lines...
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Connection Paint

Post by Nixola »

P.S: try changing this

Code: Select all

local GAME_GRID = {

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},

}
with this:

Code: Select all

local GAME_GRID = {}
for y = 1, math.ceil(love.graphics.getHeight() / 20) do
	GAME_GRID[y] = {}
	for x = 1, math.ceil(love.graphics.getWidth() / 20) do
		GAME_GRID[y][x] = 0
	end
end
I'm playing on my 1024x600 netbook monitor now ^^
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
ivan
Party member
Posts: 1915
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Connection Paint

Post by ivan »

Pretty cool. I have a prototype that's quite similar to your app.
Just a small suggestion:

Code: Select all

function checkAround(px, py)
    local dirs = {
    [1] = {0, -1},
    [2] = {1, -1},
...
It's usually better to allocate tables that don't change only once.
Lua is an interpreted language so it doesn't know that 'dirs' is constant so it will recreate the table each time you call checkAround.
Secondly, you might want to look into neightbor valuing to represent the grid:
http://www.saltgames.com/2010/a-bitwise ... -tilemaps/
In short, instead of 0 and 1, each tile could have a value between 0-256 (2^8) to represent which adjacent nodes it's connected to.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 2 guests