Not all the features are in here, spent 1-3 hour(s) working on this
--I finally do a good game
-- 2D minecraft
p = vec2(400)
--Features:
--[[
Sun
cloud
steve
grass blocks
controls
]]--
--Update thoughts:
--[[ moving clouds
tools
finished body parts
underworld
day and night
monsters
smaller D-PAD
hotbar
invintory
crafting GUI and crafting tables
more blocks
options menu(mostly parameters and output)
better animations
commands(can be toggled in the options menu)
animals
bigger worlds
]]--
--Inspired by:
--©Mojang™
--This program built by:
--©Apple Smell Games™
--Credit:
--©Mojang AB™
--Full credit:
--Markus Alexej Persson (thotherwise known as Notch)
function setup()
displayMode(FULLSCREEN)
rsw = math.random(100, 300)
rsh = math.random(50, 100)
rsx = math.random(0, 700)
end
function draw()
background(119, 119, 225, 255)
--Cloud
fill(255, 255, 255, 69)
rect(400, 650, rsw, 50)
--Grass bottom
for i = 1,6 do
fill(118, 77, 30, 255)
rect(100 * i, 0, 100, 100)
end
--Steve!
--Head
fill(180, 154, 80, 255)
rect(p.x, 250, 70, 70)
--Body
fill(0, 0, 255, 255)
rect(p.x, 105, 70, 150)
--Steve has no arms, legs,eyes, or mouth right now because of bugs...
if p.x >600 then
p.x = 400
end
if p.x <100 then
p.x = 400
end
--Sun
fill(243, 255, 0, 255)
rect(600, 600, 300, 300)
--Grass top
fill(0, 255, 0, 255)
rect(100, 100, 600, 30)
--Controls (may be a little weird looking)
sprite("Cargo Bot:Command Left", 10, 500, 50, 1000)
sprite("Cargo Bot:Command Right", 1000, 500, 50, 1000)
end
function touched(t)
if CurrentTouch.x > 949 then
p.x = p.x + 3
end
if CurrentTouch.x < 15 then
p.x = p.x - 3
end
end
@code_maker - that’s a good start.
Making a game is hard work, though, and you shouldn’t be surprised if it takes quite a few hours more to put the main features together and get them working! (I usually have to rewrite and rearrange my code a couple of times as well).
@code_maker Awesome! One thing I will warn you about though is this: don’t draw all the blocks separately. Instead, use setContext() When ever you want to place a new one, that way it is just one huge image instead of tons of smaller ones.
@Prynok But, there is the max 4096x (“2048x” on retina) size limit for images… And in 2.0, there’s the lag bug for 2D setContext()s.
The user and all related content has been deleted.
Thanks for all the info and support guys! I’m updating it an adding better stuff! Even a better Steve skin. And right now I’m working on a day - night cycle. Right now I’m debbunging it. The bug is when the sun is at its limit and it will turn night but they are just CHANGING EVERY FRAME! They switch between day and night every frame on my iPad. Now it should be about 3-6 hours before the next realese, to see what is in there, Get my next version of this game (2D Minecraft 2.0), and check in feautures.
--# Main
-- 2D minecraft
p = vec2(400)
sun = vec2()
--Features:
--[[
Sun
cloud
steve
grass blocks
controls
day night clycle, still a little bug though... could cause short seasures with people who have elepsy :(
smaller D-PAD
better Steve skin
borders at the edge od the blocks(it sends you back to the middle)
]]--
--Update thoughts:
--[[ moving clouds
tools
underworld
monsters
hotbar
invintory
crafting GUI and crafting tables
more blocks
options menu(mostly parameters and output)
better animations
commands(can be toggled in the options menu)
animals
bigger worlds
creative and survival mode
]]--
--Muti player is impossible to add... :( sorry for the incovenience but, seariously, im doing this in Lua 5.1...
--Inspired by:
--©Mojang™
--This program built by:
--©Apple Smell Games™
--Credit:
--©Mojang AB™
--Full credit:
--Markus Alexej Persson (thotherwise known as Notch)
function setup()
displayMode(FULLSCREEN)
rsw = math.random(100, 300)
rsh = math.random(50, 100)
rsx = math.random(0, 700)
supportedOrientations(LANDSCAPE_ANY)
--Open the ouput feild for now for the options menu
--Im working on an in game options menu
--Please play with caution as this game contatans a pattern that could cause seasures.
end
function draw()
Play:draw()
end
function touched(t)
if CurrentTouch.x > 949 and CurrentTouch.y >493 and CurrentTouch.y < 507 then
p.x = p.x + 3
end
if CurrentTouch.x < 15 and CurrentTouch.y <507 and CurrentTouch.x >0 and CurrentTouch.y >494 then
p.x = p.x - 3
end
end
--# Play
Play = class()
function Play:draw()
if sun.y >= 750 then
background(0, 0, 0, 255)
sun.y = -10
end
if sun.y >=30 then
background(119, 119, 225, 255)
end
--Cloud
fill(255, 255, 255, 65)
rect(400, 650, rsw, 50)
--Grass bottom
for i = 1,6 do
fill(118, 77, 30, 255)
rect(100 * i, 0, 100, 100)
end
--Steve!
sprite("Documents:Steve", p.x, 170, 100, 110)
--Head
-- fill(180, 154, 80, 255)
-- rect(p.x, 250, 70, 70)
--Body
-- fill(0, 0, 255, 255)
if p.x >600 then
p.x = 400
end
if p.x <100 then
p.x = 400
end
--Sun
fill(243, 255, 0, 255)
rect(600, 0 + sun.y, 300, 300)
sun.y = sun.y + 0.3
--Grass top
fill(0, 255, 0, 255)
rect(100, 100, 600, 30)
--Controls (improved a bit!)
sprite("Cargo Bot:Command Left", 15, 500)
sprite("Cargo Bot:Command Right", 1000, 500)
end
function Play:touched(touch)
-- Codea does not automatically call this method
end
Pretty good improvements, also format code like this
Three ‘~’ before and after your code on separate lines
The user and all related content has been deleted.
@NatTheCoder, that’e exactly what Doge said.
The user and all related content has been deleted.
@NatTheCoder How can you say something efficiently?
Correct Ignatz, I’m going to get back to coding on 2D Minecraft 3.0, 3.0 might have some bugs so if you could point out the bugs to me I would appreciate that and try to fix them
2.1 came for bug fixes, to see them, look at the bug fixes comment at Main
--# Main
-- 2D minecraft
p = vec2(400)
sun = vec2()
--Features:
--[[
Sun
cloud
steve
grass blocks
controls
day and night cycle(working fine now)
smaller D-PAD
better Steve skin
borders at the edge of the blocks(it sends you back to the middle)
]]--
--Update thoughts:
--[[ moving clouds
tools
underworld
monsters
hotbar
invintory
crafting GUI and crafting tables
more blocks
options menu(mostly parameters and output)
better animations
commands(can be toggled in the options menu)
animals
bigger worlds
creative and survival mode
TNT
fire
flint and steel
weather(when weather first comes out it will just have rain)
]]--
--Never to add:
--[[
Muti player is impossible to add... :( sorry for the incovenience but, seariously, im doing this in Lua 5.1...
3D UI INTERFACE
]]--
--Bug fixes:
--[[
Fixed issuie when game first starts at night and it doesnt erase where you have been.
Fixed issue that caused day and night to switch every frame.
]]--
--Inspired by:
--©Mojang™
--This program built by:
--©Apple Smell Games™
--Credit:
--©Mojang AB™
--Full credit:
--Markus Alexej Persson (thotherwise known as Notch)
function setup()
displayMode(FULLSCREEN)
rsw = math.random(100, 300)
rsh = math.random(50, 100)
rsx = math.random(0, 700)
supportedOrientations(LANDSCAPE_ANY)
end
function draw()
Play:draw()
end
function touched(t)
if CurrentTouch.x > 949 and CurrentTouch.y >493 and CurrentTouch.y < 507 then
p.x = p.x + 3
end
if CurrentTouch.x < 15 and CurrentTouch.y <507 and CurrentTouch.x >0 and CurrentTouch.y >494 then
p.x = p.x - 3
end
end
--# Play
Play = class()
function Play:draw()
background(0, 0, 0, 255)
if sun.y >= 750 then
background(0, 0, 0, 255)
sun.y = -10
end
if sun.y >=30 then
background(119, 119, 225, 255)
end
--Cloud
fill(255, 255, 255, 65)
rect(400, 650, rsw, 50)
--Grass bottom
for i = 1,6 do
fill(118, 77, 30, 255)
rect(100 * i, 0, 100, 100)
end
--Steve!
sprite("Documents:Steve", p.x, 170, 100, 110)
if p.x >600 then
p.x = 400
end
if p.x <100 then
p.x = 400
end
--Sun
fill(243, 255, 0, 255)
rect(600, 0 + sun.y, 300, 300)
sun.y = sun.y + 0.3
--Grass top
fill(0, 255, 0, 255)
rect(100, 100, 600, 30)
--Controls (improved a bit!)
sprite("Cargo Bot:Command Left", 15, 500)
sprite("Cargo Bot:Command Right", 1000, 500)
end
function Play:touched(touch)
end
I really don’t want to sound mean, but these controls are terrible! Try to put everything in your touch function into your draw function. Just tap somewhere else then the buttons to stop moving.
For better controls use something like this
function setup()
rightButtonPressed=false
leftButtonPressed=false
end
function draw()
if rightButtonPressed==true then
--move right
end
if leftButtonPressed==true then
--move left
end
end
function touched(touch)
if touch.state==ENDED then
rightButtonPressed=false
leftButtonPressed=false
else
if checkIfTouchIsOnTheLeftButton then
leftButtonPressed=true
end
if checkIfTouchIsOnTheRightButton then
rightButtonPressed=true
end
end
end
That’s a better way to do it
Ok, I will add that for 3.0!