Need Help with a Game

Discuss using and improving Lua and the Lua Player specific to the PSP.

Moderators: Shine, Insert_witty_name

Post Reply
train2335
Posts: 17
Joined: Sat Oct 01, 2005 2:13 pm
Location: USA
Contact:

Need Help with a Game

Post by train2335 »

Hey, I am making an Asteriods clone, incase you don't know what that is, here http://www.getfrosty.com/Games/asteroids/asteroids.htm , and I am fairly new at lua. I am wondering how do I make the asteriods go across the screen at random times in random places and still going towards the middle of the screen to the player. I have the rest of the coding pretty much done and this will help me a ton, thanks!
imhotep
Posts: 41
Joined: Tue Dec 13, 2005 9:15 pm

Post by imhotep »

look in the wiki for os.randomseed

math.random(number) for random entry points
manage all the rocks in a drawing function,
i did that and it works good.

so you spawn new rocks in a certain amount of time.

(math.mod(gametimer,refreshtime)==0 then bla)

only blit them if they are onscreen (x,y)

if X>playerX x=x-speed etc. for Y the same

resources:

http://www.lua.org/pil/21.2.html
http://www.evilmana.com/tutorials/lua_tutorial_list.php
http://psplua.com


cheers
Post Reply