Hey, I had this awesome idea, in my opinion ComputerCraft hasn't got enough games! So, what will we do? Add our own!
So the idea is everyone who has made a game or is making one will post them here, thereby creating a neat list of games for us to play inside minecraft with or against others for example on a server or alone in ssp.
The layout:
[size=6]Title[/size]
Amount of players:
Genre:
Screenshots
[spoiler]
Image1 + description
Image2 + description[/spoiler]
Code
[spoiler][code]--Paste your code here[/code*][/spoiler]
Author:
Credits(optional):
Note, remove the * from [/code*]
How to find/install the games
Singleplayer
For windows users, go to %appdata% then click on: Roaming>.minecraft>Saves>'WorldName'>computer>'ComputerID'
If you don't know the ID of your computer, in the computer type id and it will return it's ID.
In there you can open the existing game with for example notepad (or Notepad++) and copy it to here.
If you want to install a game, create a new text file, paste the code and save it as All types (*.*), make sure you have no .txt at the end!
Multiplayer
If you are the host of the server, go to the 'ServerFolder'>'WorldName'>computer>'ComputerID'
Again, to find the ID of the computer, in the computer type id and it will return it's ID, there you'll be able to find the game.
And installing a game is the same as for singleplayer, paste the code in a new text file and save it as All types (*.*)
If you aren't the host of the server ask the host to check out this page and let him/her install the desired game(s).
I will start with my own recently made game, PONG!
PONG!
Amount of players: 2
Genre: Arcade
Screenshots
Spoiler
This is the startscreen, showing the controls before pressing enter to continue to the game itself.
Here you can see the game itself.
Code
Spoiler
--Vars
width, height = term.getSize()
i = 0
i_max = width*height
x = 1
y = 1
p1 = 0
p2 = 0
pad1 = math.ceil(height/2)
pad2 = math.ceil(height/2)
up = false
right = true
--Functions
function drawPads()
term.setCursorPos(1,pad1-1)
write("#")
term.setCursorPos(1,pad1)
write("#")
term.setCursorPos(1,pad1+1)
write("#")
term.setCursorPos(1,pad1-2)
write(" ")
term.setCursorPos(1,pad1+2)
write(" ")
if pad1 == 4 then
term.setCursorPos(1,pad1-2)
write("-")
end
if pad1 == 15 then
term.setCursorPos(1,pad1+2)
write("-")
end
term.setCursorPos(width-1,pad2-1)
write("#")
term.setCursorPos(width-1,pad2)
write("#")
term.setCursorPos(width-1,pad2+1)
write("#")
term.setCursorPos(width-1,pad2-2)
write(" ")
term.setCursorPos(width-1,pad2+2)
write(" ")
if pad2 == 4 then
term.setCursorPos(width-1,pad2-2)
write("-")
end
if pad2 == 15 then
term.setCursorPos(width-1,pad2+2)
write("-")
end
end
function ball()
term.setCursorPos(x,y)
write(" ")
if up == true then
y = y - 1
else
y = y + 1
end
if right == true then
if (x == width - 2) then
if y == pad2 or y == pad2-1 or y == pad2+1 then
x = x - 1
right = false
elseif up == true and y == pad2-2 then
x = x - 1
right = false
elseif up == false and y == pad2+2 then
x = x - 1
right = false
else
x = x + 1
end
else
x = x + 1
end
else
if (x == 2) then
if y == pad1 or y == pad1-1 or y == pad1+1 then
x = x + 1
right = true
elseif up == true and y == pad1-2 then
x = x + 1
right = true
elseif up == false and y == pad1+2 then
x = x + 1
right = true
else
x = x - 1
end
else
x = x - 1
end
end
if x == 1 then
right = true
p2 = p2 + 1
x = math.ceil(width/2)
y = math.ceil(height/2)
term.setCursorPos(math.ceil(width/2)-3,1)
write(p1.." | "..p2)
end
if x == (width - 1) then
right = false
p1 = p1 + 1
x = math.ceil(width/2)
y = math.ceil(height/2)
term.setCursorPos(math.ceil(width/2)-3,1)
write(p1.." | "..p2)
end
if y == 3 then up = false end
if y == height-2 then up = true end
end
--Intro
term.clear()
term.setCursorPos(1,1)
print("")
print("")
print(" X==---------------------------------==X")
print(" |ComputerCraft Pong, made by Chub1337!|")
print(" X==---------------------------------==X")
print("")
print("")
print("")
print(" Player 1 controls: W = up, S = down")
print("")
print(" Player 2 controls: O = up, L = down")
print("")
print("")
print("")
print("")
print("")
print("")
write("Press <Enter> to continue.")
io.read()
term.clear()
term.setCursorPos(1,1)
write("Player 1")
term.setCursorPos(width-8,1)
write("Player 2")
term.setCursorPos(math.ceil(width/2)-3,1)
write(p1.." | "..p2)
drawPads()
term.setCursorPos(1,height)
write(pad1.."|"..pad2)
for i=1,width-1,1 do
term.setCursorPos(i,2)
write("-")
end
term.setCursorPos(1,height-1)
for i=1,width-1,1 do
term.setCursorPos(i,height-1)
write("-")
end
--Pong
x = math.ceil(width/2)
y = math.ceil(height/2)
dir = math.ceil(math.random(0,4))
if dir == 1 then
up = true
right = true
elseif dir == 2 then
up = true
right = false
elseif dir == 3 then
up = false
right = true
elseif dir == 4 then
up = false
right = false
end
function timerupdate()
ball()
term.setCursorPos(7,height)
write("X:"..x.." ")
term.setCursorPos(13,height)
write("Y:"..y.." ")
term.setCursorPos(18,height)
write("up:"..tostring(up).." ")
term.setCursorPos(30,height)
write("right:"..tostring(right).." ")
term.setCursorPos(x,y)
write("O")
term.setCursorPos(1,height)
write(pad1.."|"..pad2.." ")
timer1 = os.startTimer(.1)
end
timer1 = os.startTimer(.1)
while true do
event, par = os.pullEvent()
if event == "timer" and par == timer1 then timerupdate() end
if event == "char" then
if par == "w" then
pad1 = pad1 - 1
if pad1 < 4 then
pad1 = 4
end
elseif par == "s" then
pad1 = pad1 + 1
if pad1 > height-3 then
pad1 = height-3
end
end
if par == "o" then
pad2 = pad2 - 1
if pad2 < 4 then
pad2 = 4
end
elseif par == "l" then
pad2 = pad2 + 1
if pad2 > height-3 then
pad2 = height-3
end
end
end
drawPads()
end
Author: Chub1337
Credits: Casper7526 and Cloudy for helping me with handling multiple inputs at the same time.
We've probably all played it before, the game where you're a helicopter (or a simple arrow) and you have to navigate trough a horizontal or vertical tunnel.
Well, it's back! And now on ComputerCraft, and it even has it's own highscore system, meaning it saves the best score + their name!
Screenshots
Spoiler
This the the startscreen, showing the controls and the current highscore
Here you can see the gameplay itself
And as a last screenshot I beat my previous highscore
Code
Spoiler
--Vars
width, height = term.getSize()
i = 0
i_max = width*height
x = 1
y = 1
score = 0
tun_y = math.ceil(height/2)-4
tun_h = 7
s_time = 10
timer2 = 5+math.ceil(math.random(0,s_time))
dir = 0
timer3 = 400
lives = 3
--Highscore
if not fs.exists("tunnel_hs") then
local tmp=io.open("tunnel_hs", "w")
tmp:write("Name")
tmp:write(1)
tmp:close()
end
hs = io.open("tunnel_hs","r")
hs_name = hs:read("*l")
hs_score = hs:read("*l")
hs:close()
--Table
screen = {}
for a=1,width-1,1 do
screen[a] = {}
end
for a=1,width-1,1 do
for b=3,height-2,1 do
screen[a][b] = " "
end
end
--Functions
function drawPlayer()
term.setCursorPos(2,y)
write(">")
if y == 3 then
term.setCursorPos(2,y-1)
write("-")
end
if y == height-2 then
term.setCursorPos(2,y+1)
write("-")
end
end
function tunnel()
for a=1,width-2,1 do
for b=3,height-2,1 do
screen[a][b] = screen[a+1][b]
term.setCursorPos(a,B)/>/>
write(screen[a][b])
end
end
for a=1,height-2,1 do
screen[width-1][a] = "#"
if a >= tun_y and a <= tun_y+tun_h then screen[width-1][a] = " " end
term.setCursorPos(width-1,a)
if screen[a][width-1] then write(screen[a][width-1]) end
end
if timer2 == 0 then
dir = math.ceil(math.random(0,2))
if dir == 1 then tun_y = tun_y + 1 end
if dir == 2 then tun_y = tun_y - 1 end
if tun_y == 2 then tun_y = 3 end
if tun_y == height-1-tun_h then tun_y = height-2-tun_h end
timer2 = 5+math.ceil(math.random(0,s_time))
end
timer2 = timer2 - 1
if timer3 == 0 then
tun_h = tun_h - 1
timer3 = 160+tun_h*40
if tun_h == 1 then
tun_h = 2
s_time = s_time-1
if s_time == 0 then s_time = 1 end
end
end
timer3 = timer3 - 1
end
function gameover()
lives = lives-1
timer3 = 400
tun_h = 7
tun_y = math.ceil(height/2)-4
y = math.ceil(height/2)
s_time = 10
if lives == -1 then
term.clear()
term.setCursorPos(math.ceil(width/2)-5,math.ceil(height/2)-4)
write("Game Over!")
term.setCursorPos(math.ceil(width/2)-10,math.ceil(height/2))
write("Your score is: "..score)
term.setCursorPos(math.ceil(width/2)-13,math.ceil(height/2)+2)
if score > tonumber(hs_score) then
write("You have beaten \n "..hs_name.."'s highscore of "..hs_score.."!")
term.setCursorPos(math.ceil(width/2)-10,math.ceil(height/2)+5)
write("Please enter your name: ")
hs = io.open("tunnel_hs","w")
name = io.read()
hs:write(name.."\n")
hs:write(score.."\n")
hs:close()
else
write("Too bad, you didn't beat \n "..hs_name.."'s highscore of "..hs_score..".")
end
term.setCursorPos(1,height)
write("Press <Enter> to continue.")
read()
score = 0
else
term.setCursorPos(1,1)
write("Score: 0 ")
for a=1,width-1,1 do
for b=3,height-2,1 do
screen[a][b] = " "
term.setCursorPos(a,B)/>/>
write(screen[a][b])
end
end
end
end
function timerupdate()
tunnel()
timer1 = os.startTimer(.05)
end
--Intro
term.clear()
term.setCursorPos(1,1)
print("")
print("")
print(" X==---------------------------------==X")
print(" | CC Games: Tunnel, made by Chub1337! |")
print(" X==---------------------------------==X")
print("")
print("")
print("")
print(" Controls:")
print("")
print(" UP: ArrowKey-Up")
print(" DOWN: ArrowKey-Down")
print("")
print(" Current Highscore:")
print(" "..hs_name.." with "..hs_score)
print("")
print("")
write("Press <Enter> to continue.")
io.read()
term.clear()
term.setCursorPos(1,1)
--Screen
write("Score: "..score)
for i=1,width-1,1 do
term.setCursorPos(i,2)
write("-")
end
term.setCursorPos(1,height-1)
for i=1,width-1,1 do
term.setCursorPos(i,height-1)
write("-")
end
--Tunnel
x = 2
y = math.ceil(height/2)
timer1 = os.startTimer(.05)
while lives~=-1 do
event, par = os.pullEvent()
if event == "timer" and par == timer1 then timerupdate() end
if event == "key" then
if par == 200 then
y = y - 1
if y < 3 then
y = 3
end
term.setCursorPos(2,y+1)
write(" ")
elseif par == 208 then
y = y + 1
if y > height-2 then
y = height-2
end
term.setCursorPos(2,y-1)
write(" ")
end
end
drawPlayer()
score = score+1
term.setCursorPos(1,1)
write("Score: "..score)
term.setCursorPos(math.ceil(width/2),1)
write("Lives: "..lives)
term.setCursorPos(1,height)
--write("tun_h: "..tun_h.." s_time: "..s_time.." timer3: "..timer3.." ")
write("Highscore: "..hs_score.." by "..hs_name..".")
if screen[2][y] == "#" then
gameover()
end
end
Hey guys. I have nearly mastered RinAPI (used for physics, entities, etc. and specifically game dev) and I have MineDwarf as a blank slate, and I was hoping for any good ideas if you guys have them.
Tanks -- game where you aim where a projectile will land using power and angle. ( should be a good work out for your physics )
Pokemon -- ok so kinda of a joke suggestion
Space invaders -- classic
Tetris -- classic
Elf bolling -- Google it if you haven't played it.
Mario -- original 2d side scrolling game
catapult game -- a game where you have to select power and projectile for a catapult and then it fires at a building of some kind. points for destruction