Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
c39fc77
fixed dirction
Apr 19, 2011
d0c2586
random coloured rpxelrain for pentawall
Jun 28, 2011
5bab915
README: s/twobit/2bt/
Aug 1, 2011
2824be2
Merge branch 'master' of https://github.com/2bt/wall-E
Aug 1, 2011
c5c122c
Merge branch 'master' of github.com:eri451/wall-E
Aug 1, 2011
0f0efeb
Merge branch 'master' of https://github.com/2bt/wall-E
Aug 12, 2011
a9bae23
fullscreen spalten
dodo Sep 13, 2011
50e5511
balken: 3D spalten fork
dodo Sep 13, 2011
ecb32af
swap the swp
dodo Sep 13, 2011
b96338c
3:D
dodo Sep 14, 2011
ea89065
variable dropspeed
eri451 Nov 21, 2011
aa5f322
cleaned indentation
eri451 Nov 21, 2011
f911b38
better fade, bg/fg
eri451 Nov 22, 2011
6b8ac4e
variable drop length
eri451 Nov 22, 2011
d3c01da
Merge remote-tracking branch 'eri/master'
dodo Nov 22, 2011
1c32a61
dont hardcode wall size
dodo Nov 22, 2011
1e835be
metablobs
dodo Nov 23, 2011
c0dd6c9
add lust
dodo Nov 23, 2011
9d15613
fireflies
dodo Nov 23, 2011
d835d6f
3d search
eri451 Dec 3, 2011
a1f19f9
mv helper functions in own file
dodo Dec 29, 2011
04bd05e
greetings from the 28c3 congress
dodo Dec 29, 2011
1f7af18
inroundbound helper
dodo Dec 29, 2011
b96bd8d
shoot!
dodo Dec 29, 2011
f922112
absolute player position
dodo Dec 29, 2011
7c7d65d
dont access globals
dodo Dec 29, 2011
c1b98da
return modulo as well
dodo Dec 29, 2011
0aeeedb
fixed player abs pos when out of roundbound
dodo Dec 29, 2011
ad8748a
Target
dodo Dec 29, 2011
074b62e
let user halt with b
dodo Dec 29, 2011
eb0b863
change color when target is out of pov
dodo Dec 29, 2011
45152cf
add enemys
Dec 29, 2011
4e998a2
Merge pull request #1 from apoh/master
dodo Dec 29, 2011
0a4227e
smoother viewport jumps
dodo Dec 29, 2011
6b42693
flash enemy
Dec 29, 2011
60eb7ce
Merge branch 'master' of git://github.com/apoh/wall-E
dodo Dec 29, 2011
e33b70d
flash animation
dodo Dec 29, 2011
db3cbaa
random enemies
Dec 29, 2011
8730aa2
Merge branch 'master' of https://github.com/dodo/wall-E
Dec 29, 2011
4101bc3
Vector:eq method
dodo Dec 29, 2011
6b3a81e
enemies to target
apoh Dec 29, 2011
fa02d0c
add enemies automaticly
apoh Dec 29, 2011
23ce8be
thats a bug
dodo Dec 29, 2011
38889c2
destroy methods
dodo Dec 29, 2011
3406e1a
typo
dodo Dec 29, 2011
358f561
dont create first enemy
dodo Dec 29, 2011
a4104ac
Merge branch 'master' of https://github.com/dodo/wall-E
apoh Dec 29, 2011
7a5ee1f
random drops with water effect hacked on 28c3 day 3 :)
Dec 29, 2011
47007a5
flexible consts
dodo Dec 29, 2011
34a4170
let enemies really die when hit
dodo Dec 29, 2011
b833a59
abs pos for projectile in collision check
dodo Dec 29, 2011
6997a66
stats
dodo Dec 29, 2011
98e187c
Merge branch 'master' of https://github.com/dodo/wall-E
apoh Dec 29, 2011
84c3891
greater range
dodo Dec 30, 2011
d0488a8
targets have a higher priority in draw order (and therefor in the radar)
dodo Dec 30, 2011
9768223
first buggy sokobanimplementation
apoh Dec 30, 2011
1c12e46
Merge pull request #2 from jkroll20/master
dodo Dec 30, 2011
e5c7119
quick conway's game of life hack
Dec 30, 2011
384c61f
collisiondetection for boxes
apoh Dec 30, 2011
7416460
gamelogic ready
apoh Dec 30, 2011
9699c6f
fixed boxesbug
apoh Dec 31, 2011
80c9b47
multiple keydownevents when key is pressed fixed
apoh Dec 31, 2011
2f51a54
Merge pull request #3 from jkroll20/master
dodo Dec 31, 2011
e13f303
now with mor the one level
apoh Jan 2, 2012
23cb91d
bugfix leveldrawing
apoh Jan 2, 2012
5a60e8b
place level in the middle of the matrix
apoh Jan 2, 2012
8608911
bugfix levelplacement
apoh Jan 2, 2012
49a4bb4
Merge branch 'master' of git://github.com/apoh/wall-E
dodo Jan 4, 2012
3cae928
bugfixes
dodo Jan 4, 2012
405d95e
Merge branch 'master' of github.com:dodo/wall-E
dodo Jan 4, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
*.pyc
*swp
4 changes: 4 additions & 0 deletions balken/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
balken
=======

3D spalten :)
132 changes: 132 additions & 0 deletions balken/bot.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@


function Field:getInput()

local key_down = {}
if self.key_state then
-- human
key_down.right = self.key_state.right
key_down.left = self.key_state.left
key_down.down = self.key_state.down
key_down.rot = self.key_state.a

else
-- bot
key_down = self:bot()
end

local events = {}
local dx = bool[key_down.right] - bool[key_down.left]
if dx ~= self.input.dx then
self.input.rep = 0
end
self.input.dx = dx
self.input.rep = self.input.rep - 1
if self.input.rep <= 0 then
events.dx = dx
self.input.rep = 3
else
events.dx = 0
end
events.down = key_down.down
events.rot = key_down.rot and not self.input.rot
self.input.rot = key_down.rot

return events
end


function Field:bot()

-- stateless bot - very inefficient, but it kinda works
-- go through all moves, choose the 'best'

local save_x = self.x
local save_y = self.y

local moves = {}
-- do nothing if no move can be found
moves[0] = {
{ x = self.x, rot = 0 }
}

for rot = 0, 2 do
for x = 1, 6 do
self.x = x
self.y = save_y
if not self:collision() then
repeat
self.y = self.y + 1
until self:collision()
self.y = self.y - 1
if self.y >= 3 then
self:pushColumn()

self:findGemsInLine()
local magic = self.combo_count * 4
for y2 = 1, 13 do
if math.max(unpack(self.grid[self.layer][y2])) > 0 then
magic = magic + y2
break
end
end

if not moves[magic] then
moves[magic] = {}
end
table.insert(moves[magic], { x = x, rot = rot })

self.gems_in_line = {}
self.combo_count = 0


-- reverse the push
self.grid[self.layer][self.y][self.x] = 0
self.grid[self.layer][self.y - 1][self.x] = 0
self.grid[self.layer][self.y - 2][self.x] = 0
end

end
end

-- rotate
local c = self.column
c[1], c[2], c[3] = c[3], c[1], c[2]
end
self.x = save_x
self.y = save_y

-- select any of the best moves
local max_magic = 0
for i, l in pairs(moves) do
if i > max_magic then
max_magic = i
end
end

local best_move = moves[max_magic][1]
for _, move in ipairs(moves[max_magic]) do
if math.abs(move.x - self.x) < math.abs(best_move.x - self.x) then
best_move = move
end
end

local key_down = {}

-- easy bot
key_down.left = self.x > best_move.x and math.random(10) == 1
key_down.right = self.x < best_move.x and math.random(10) == 1
key_down.down = self.x == best_move.x and self.y > math.random(10)
key_down.rot = best_move.rot > 0 and math.random(3) == 1

--[[
-- fast bot
key_down.left = self.x > best_move.x
key_down.right = self.x < best_move.x
key_down.down = self.x == best_move.x or math.random(3) == 1
key_down.rot = best_move.rot > 0 and math.random(2) == 1
--]]

return key_down
end

9 changes: 9 additions & 0 deletions balken/conf.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function love.conf(t)
t.title = "spalten"
t.author = "twobit"
t.screen.width = 320
t.screen.height = 300
t.screen.vsync = false
t.modules.physics = false
t.modules.mouse = false
end
103 changes: 103 additions & 0 deletions balken/draw.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@

local string = string
local floor = math.floor


local gem_colors = {}
gem_colors[-2] = {136, 136, 136} -- border
gem_colors[-1] = { 85, 85, 85} -- brick
gem_colors[0] = { 0, 0, 0} -- background

gem_colors[1] = {187, 34, 0}
gem_colors[2] = { 0, 170, 187}
gem_colors[3] = { 0, 187, 0}
gem_colors[4] = {187, 187, 0}
gem_colors[5] = {136, 0, 187}
gem_colors[6] = { 0, 187, 187}

local function Color(c)
return string.format("%02X%02X%02X", floor(c[1]), floor(c[2]), floor(c[3]))
end


function Field:draw()

local layer = self.layer
if self.state ~= "normal" then
layer = (layer - 1) % self.width + 1
end

local g = {}
for i = 0, self.height+1 do
local row = {}
for j = 0, self.width+1 do
row[j] = {}
for i, col in ipairs(gem_colors[0]) do
row[j][i] = col
end
end
g[i] = row
end

for _z = 0, self.width+1 do
local z = ((self.width - _z) + layer) % self.width + 1
for y = 0, self.height+1 do
local row = self.grid[z][y] or {}
for x = 0, self.width+1 do

local gem = row[x]
if self.state == "normal" and y > 0 and x == self.x then
-- also draw active column
gem = self.column[self.y - y + 1] or gem
end
local is_empty =
g[y][x][1] == gem_colors[0][1] and
g[y][x][2] == gem_colors[0][2] and
g[y][x][3] == gem_colors[0][3]
gem = gem or -2
for i, col in ipairs(gem_colors[gem]) do
if is_empty or gem ~= 0 then
g[y][x][i] = col * _z/(self.width+1)
if gem ~= -2 then
g[y][x][i] = g[y][x][i] * (
(z == layer or
(x==self.x and
y>=self.y-2 and
y<=self.y)) and
1 or 0.3)
end
end
end
end
end
end
for y = 0, self.height+1 do
for x = 0, self.width+1 do
wall:pixel(self.pos + x-1, y-1, Color(g[y][x]))
end
end

-- draw flashing gems
if self.state == "highlight" then
for _, coords in pairs(self.gems_in_line) do
local color = ({ "ffffff", "000000" })[self.state_delay % 3 + 1]
if color then
wall:pixel(self.pos + coords.x-1, coords.y-1, color)
end
end
end

-- draw score
local score = self.score
local y = self.height
local x = self.pos == 0 and self.width or self.pos-1
while score > 0 and y >= 0 do
if score % 2 > 0 then
wall:pixel(x, y, "aaaaaa")
end
score = math.floor(score / 2)
y = y - 1
end
end


Loading