artificial coding
Moderators: Shine, Insert_witty_name
artificial coding
im making a small shooting game and i want some artificial coding help wut type of codes do i have 2 use and is math.randoomseed(os.time()) needed?
thnx in advance ;)
thnx in advance ;)
im not gay
no no ways
no no ways
You need the math.randomseed(os.time()) to ensure you random numbers really are random. If you don't seed the random number generator (or if you seed it with a known value) then the number sequences will be the same each time. By using os.time to seed it you use a different number each time the program runs.
As for what type of code you need, I think you'll need to be a bit more specific.
Let us know a bit more detail and I'm sure someone can help.
HTH,
JC
As for what type of code you need, I think you'll need to be a bit more specific.
Let us know a bit more detail and I'm sure someone can help.
HTH,
JC
This is not an "OMG TEACH ME TO CODZ0R!" forum. This is ps2/psp specific homebrew dev discussion. Learn how to code before you come here, because we are not going to teach you.
Shoot Pixels Not People!
Makeshift Development
Makeshift Development
It's pretty easy once you break down what you want to do:
1) See if you enemy is lined up with your character (check the X or Y setting were appropriate)
2) If he is lined up use a random number to decide whether or not to shoot (if math.random(1,3) = 1 then ......... end)
As far as movement is concerned this is slightly more complicated. You first need to decide if your enemy will 'chase' your character or just move randomly.
1) See if you enemy is lined up with your character (check the X or Y setting were appropriate)
2) If he is lined up use a random number to decide whether or not to shoot (if math.random(1,3) = 1 then ......... end)
As far as movement is concerned this is slightly more complicated. You first need to decide if your enemy will 'chase' your character or just move randomly.
Yep, that's correct.
Check out these links, they are pretty usefully
http://www.lua.org/pil/
http://www.lua.org/manual/5.0/manual.html
Check out these links, they are pretty usefully
http://www.lua.org/pil/
http://www.lua.org/manual/5.0/manual.html
Remember, don't sweat the petty things
and don't pet the sweaty things.......
and don't pet the sweaty things.......