| View previous topic :: View next topic |
| Author |
Message |
Dark Killer
Joined: 25 Jan 2005 Posts: 32
|
Posted: Mon Aug 15, 2005 11:22 am Post subject: KaboomPSP 0.1 |
|
|
my first psp game and also the first thing I've ever coded in LUA. KaboomPSP is a clone of the Atari 2600 game Kaboom.
http://www.sendmefile.com/00046899
sorry for having to use a free host but im probably the only coder without webspace :p |
|
| Back to top |
|
 |
emumaniac
Joined: 08 May 2005 Posts: 79
|
|
| Back to top |
|
 |
Dark Killer
Joined: 25 Jan 2005 Posts: 32
|
Posted: Mon Aug 15, 2005 10:51 pm Post subject: |
|
|
i'm having a little problem that for the life of me I cant figure out the cause of: after 25 execution loops luaplayer returns an error at line 26 due to a stack overflow. here's the code, hopefully someone could show me what's causing this and how to resolve it.
| Code: | --[[
KaboomPSP, Copyright (c) 2005 Dark Killer
]]
-- load images
background = Image.load("bg.png")
title = Image.load("title.png")
bar = Image.load("bar.png")
bomb = Image.load("bomb.png")
function movebomb()
by=by+2
end
function newbomb()
--bomb:clear(green)
--bomb = Image.load("bomb.png")
--math.randomseed(os.time())
by = 25
math.randomseed(os.time())
bx = math.random(220)
end
function Control()
--screen.waitVblankStart()
pad = Controls.read()
if pad:left() then
x = x - 9
elseif pad:right() then
x = x + 9
elseif x<1 then
x=1
elseif pad:circle() then
screen:save("screenshot.tga")
end
main()
end
function main()
screen:blit(0, 0, background, 0, 0, background:width(), background:height(), false)
screen:print(280, 5, "Score: " .. pnts, green)
screen:blit(bx, by, bomb)
screen:blit(x, 237, bar)
if bx + 50 >= x and bx + 50 <= x + 94 then
if by + 50 >= 237 and by + 50 <= 256 then
pnts = pnts + 100
newbomb()
end
elseif by > 250 then
if pnts >= 100 then
pnts = pnts - 100
end
newbomb()
end
movebomb()
screen.waitVblankStart()
screen.flip()
Control()
end
screen:blit(0, 0, title, 0, 0, title:width(), title:height(), false)
screen.waitVblankStart()
screen.flip()
screen.waitVblankStart(141)
green = Color.new(0, 255, 0)
x=2
pnts=0
newbomb()
main() |
|
|
| Back to top |
|
 |
alex_dsnews
Joined: 03 Aug 2005 Posts: 13
|
Posted: Mon Aug 15, 2005 10:58 pm Post subject: |
|
|
| It probably won't help, but you don't need math.randomseed(os.time()) every loop, just once per program run is enough. |
|
| Back to top |
|
 |
Dark Killer
Joined: 25 Jan 2005 Posts: 32
|
Posted: Tue Aug 16, 2005 5:20 am Post subject: |
|
|
| thanks for the tip alex but, like I expected, it didnt solve my problem. I sure hope someone can help me because I've tried everything and I'd really hate to have to abandon development on this game. |
|
| Back to top |
|
 |
Dark Killer
Joined: 25 Jan 2005 Posts: 32
|
Posted: Tue Aug 16, 2005 6:20 am Post subject: |
|
|
| Update: I finally got the stack overflow bug fixed so everyone can expect an update laster tonight :) |
|
| Back to top |
|
 |
ector
Joined: 12 May 2005 Posts: 195
|
Posted: Tue Aug 16, 2005 7:04 am Post subject: |
|
|
I suspect your problem was that main() calls control() and control in turn calls main? :) _________________ http://www.dtek.chalmers.se/~tronic/PSPTexTool.zip Free texture converter for PSP with source. More to come. |
|
| Back to top |
|
 |
Dark Killer
Joined: 25 Jan 2005 Posts: 32
|
|
| Back to top |
|
 |
emumaniac
Joined: 08 May 2005 Posts: 79
|
|
| Back to top |
|
 |
|