This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Ninja_swag's profile picture

Game Help

Started by Ninja_swag, 22 November 2013 - 11:13 PM
Ninja_swag #1
Posted 23 November 2013 - 12:13 AM
ive been working on a halo style game i need to be able to create/load maps and switch between weapons while in game if anyone could give me any advice on how to make the level creating/loading system and a weapon system thatd be great
Lyqyd #2
Posted 23 November 2013 - 01:52 AM
Post the code you currently have and more specific questions. It's pretty hard to answer questions about the best way to do things if we don't know what you're working with.
Ninja_swag #3
Posted 23 November 2013 - 12:47 PM
im using gameapi because its easier but if i could get some movement help then ill switch to all of the code being in the program itself

shell.run('gameapi')
player = actor:new(5,10,'@')
function game.key(k)
if k==keys.a then
  player:addX(-1)
elseif k==keys.d then
  player:addX(1)
elseif k==keys.w then
  player:addY(-1)
elseif k==keys.s then
  player:addY(1)
end
end
game.start()
MKlegoman357 #4
Posted 23 November 2013 - 02:08 PM
If you don't even know how to create movement then how are you going to make the actual game? A lot of people try to make a game as soon as they know something about programming in Lua but they often fail and give up. Games are not a good start for a beginner.
Edited on 23 November 2013 - 01:45 PM
Kingdaro #5
Posted 23 November 2013 - 02:54 PM
I'll just remake the game API if people are actually still using it, because it's a little broken at the moment.

EDIT: Yeah, just don't use it. This was coded pretty badly.
Edited on 23 November 2013 - 01:59 PM
Ninja_swag #6
Posted 23 November 2013 - 03:33 PM
i know the code is written badly most of my coding experience is from making password locks
Kingdaro #7
Posted 23 November 2013 - 03:39 PM
I meant the Game API. Your code is fine for the most part, I just recommend against using the API.
MKlegoman357 #8
Posted 23 November 2013 - 04:53 PM
i know the code is written badly most of my coding experience is from making password locks

Actually your code is very good. The only thing that could be improved is to make variable 'player' local:


local player = actor:new(5,10,'@')
Edited on 23 November 2013 - 03:55 PM