Posted 24 July 2013 - 04:50 PM
So i got this idea while one the bus and i noted them:
And the game is quite simple yet is getting some bugs…
So the player has 10 points or lives or whatever, and this player has to defeat 3 enemys wich can use numbers from 1 to 4. Ok so the player has to use the lives carefully (because the lives will be used to defeat the enemy and the lives don't regenerate so the player has 10 lives and for each attack he uses he loses the lives).
This way if an enemy uses 3 and the player uses 4, the player wins and the points change from 10 to 6.
So the next round the enemy use 2 and the player 2, the player loses and the points change from 6 to 4.
Finally for the last round the player will use the max amount of lives he has(because is the last round XD)and will play 4, if the enemy uses 3 or lower the player wins and if the enemy uses 4 the player loses.
So in the end of the game there will be a stats board with:
Lifes: The point that the player didnt use
Wins: The number of enemys that the player defeated
Loses: The number of defeats
So the game is simple but i am having some trouble in the code :P/> i want to post so you guys can have an idea of what i am working on and for some advices.
The game has A LOT of bugs and is really glitchy XDDD
So hope you guys want to help me and hope you like ;)/>
Game code(i don't have pastebin yet):
3 enemies
enemies use numbers randomly from 0 to 4
if player number = or > to enemy number player loses
if player number < enemy enemy loses in the end print the number of victories and defeats
So this is the basic ideas that i got… So i started to do some tests on the phone for later use.And the game is quite simple yet is getting some bugs…
So the player has 10 points or lives or whatever, and this player has to defeat 3 enemys wich can use numbers from 1 to 4. Ok so the player has to use the lives carefully (because the lives will be used to defeat the enemy and the lives don't regenerate so the player has 10 lives and for each attack he uses he loses the lives).
This way if an enemy uses 3 and the player uses 4, the player wins and the points change from 10 to 6.
So the next round the enemy use 2 and the player 2, the player loses and the points change from 6 to 4.
Finally for the last round the player will use the max amount of lives he has(because is the last round XD)and will play 4, if the enemy uses 3 or lower the player wins and if the enemy uses 4 the player loses.
So in the end of the game there will be a stats board with:
Lifes: The point that the player didnt use
Wins: The number of enemys that the player defeated
Loses: The number of defeats
So the game is simple but i am having some trouble in the code :P/> i want to post so you guys can have an idea of what i am working on and for some advices.
The game has A LOT of bugs and is really glitchy XDDD
So hope you guys want to help me and hope you like ;)/>
Game code(i don't have pastebin yet):
Spoiler
--[[10 number to waste
3 enemies
enemies use numbers randomly from 0 to 4
if player number = or > to enemy number player loses
if player number < enemy enemy loses in the end print the number of victories and defeats
]]--
function random(min,max)
r = math.random(min,max)
print(r)
end
function input()
write("Enter your number:")
ni = read()
ni = tonumber(ni)
end
function checkrounds()
if wins == 3 then
end
if lives <= 0 then
end
if roundsc >= 3 then
print("The game has ended!")
print()
print("STATS:")
print("Lifes:"..lives)
print("Wins:"..wins)
print("Loses:"..loses)
end
end
function restart()
checkrounds()
shell.run("clear")
print("This is round #"..roundsc..".")
print("You have "..lives.." lives remaining.")
input()
random(1,4)
if ni > lives then
print("You don't have so much lifes! Currently you have "..lives.." lifes remaining!")
sleep(2.5)
restart()
elseif ni > 10 then
else
end
if ni <= r then
checkrounds()
print("You lose!")
loses = loses+1
lives = lives-ni
rounds = rounds-1
roundsc = roundsc+1
print("Remaining lifes:"..lives)
sleep(2)
elseif ni > r then
print("You win!")
wins = wins+1
lives = lives-ni
rounds = rounds-1
roundsc = roundsc+1
print("Remaining lifes:"..lives)
sleep(2)
restart()
else
end
end
-----------------
lives = 100
loses = 0
wins = 0
rounds = 3
roundsc = 1
-----------------
shell.run("clear")
print("Welcome to RoD's game!")
sleep(1)
shell.run("clear")
print("Pick a number from 0 to 10, if your number is greater than the enemy number you win!")
sleep(4)
shell.run("clear")
if wins == 3 then
print("You won!")
end
restart()
checkrounds()
if lives <= 0 then
print("GAME OVER")
elseif lives > 0 then
restart()
else
end