2D minecraft

I tryed it but, i couldn’t move the player… It could Maby be that I have an iPad 1 with Codea 1.5… And you guys have Codea 2.0, but… Since I’m the developer I have to test the game… So I will make it up to you guys by making the controls more simple…

The version of codea shouldn’t make any difference.

@code_maker, did you change checkIfTouchIsOnTheLeftButton and checkIfTouchIsOnTheRightButton to actually checks? because if you left them like that they are worthless.

May I suggest you use Spritely for the images?

@aurumcoder2624 - Spritely stores images very inefficiently, I wouldn’t recommend using it here

Oh…

3.0 is now available with better stuff!


--# Main

-- 2D minecraft

p = vec2(400)

sun = vec2()



--Features:

--[[
Sun
cloud
steve
grass blocks
controls
day and night cycle
smaller D-PAD
better Steve skin
borders at the edge of the blocks(it sends you back to the middle)
bigger worlds(still working on code for the camera to move with you :) )
survival mode(im gonna think of creative mode for 0.3.1 or 0.4.0)
lives
sounds when you go off the edge
deaths
5% speed
hotbar(still needs a little work though, this means tools or mining coming soon!)
]]--
--Update thoughts:
--[[ moving clouds
tools
underworld
ather
mining
monsters
invintory
crafting GUI and crafting tables(working on the crafting GUI, crafting tables coming soon! possibly 4.0 through 5.1)
more blocks
options menu(mostly parameters and output)
better animations
commands(can be toggled in the options menu)
animals
TNT
fire
flint and steel
weather(when weather first comes out it will just have rain)
stars
saving the data on your lives(im working on it! :)
nameTags
creative mode

]]--

--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:

--[[ no fixed

]]--

--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)

    
   
  version = "0.3.0 beta"

lives = 10

    supportedOrientations(LANDSCAPE_ANY)
  
end

function draw()

    
    background(0, 0, 0, 255)
 
  Play:draw()

--readProjectData("health")

end

function touched(t)

       if t.x >949 and t.x <1004 and t.y >494 and t.y <504 then

        p.x = p.x + 5

        end

        if t.x >0 and t.x <23 and t.y >494 and t.y <504 then

            p.x = p.x - 5

    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 = -100

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,10 do 

    fill(118, 77, 30, 255)

    rect(100 * i, 0, 100, 100)

    end

    --Steve!

    sprite("Documents:Steve", p.x, 185, 100, 110)

    --Head

--    fill(180, 154, 80, 255)

 --   rect(p.x, 250, 70, 70)

    --Body

--    fill(0, 0, 255, 255)

if p.x >1000 then

p.x = 400

    --saveProjectData("health", 1)
    
    for i = 1,1 do

        sound(SOUND_HIT, 41660)

        lives = lives - 1

    end

end

if p.x <100 then 

    p.x = 400
    
    for i = 1,1 do

        sound(SOUND_HIT, 41660)

        lives = lives - 1

    end

end

--fill(127, 127, 127, 90)

--rect(300, 300, 70, 70)

--fill(255, 255, 255, 255)

--text("Craft", 330, 330)

--if CurrentTouch.x >294 and CurrentTouch.x <374 and CurrentTouch.y >294 and CurrentTouch.y <374 then

    --Craft:draw()

--end

--Inventory/hotbar

fill(127, 127, 127, 107)

rect(700, 600, 70, 70)

rect(800, 600, 70, 70)

for i = 1,lives do

    sprite("Planet Cute:Heart", 70 * i, 600, 50, 50)

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, 1000, 30)

        --Controls

    sprite("Cargo Bot:Command Left", 15, 500)

    sprite("Cargo Bot:Command Right", 1000, 500)

    if lives == 0 then

        restart()

        --clearProjectData()

    end

end

function Play:touched(touch)

    -- Codea does not automatically call this method

end

--# Craft

Craft = class()

function Craft:draw()

    background(123, 104, 30, 255)

    fill(255, 255, 255, 255)

    text("Crafting not avable yet... \
 try again in 0.3.1 or 0.4.0 :(", 300, 400)

end

function Craft:touched(touch)

    -- Codea does not automatically call this method

end

Let me know if any of you guys have found bugs in 0.3.0… I’m almost finished with 3.1

–# Main
–3.1
– 2D minecraft

p = vec2(400)

sun = vec2()

m = vec2(0)

–Features:

–[[
Sun
cloud
steve
grass blocks
controls
day and night cycle
smaller D-PAD
better Steve skin
borders at the edge of the blocks(it sends you back to the middle)
bigger worlds(still working on code for the camera to move with you :slight_smile: )
survival mode
lives
sounds when you go off the edge
deaths
5% speed
hotbar(still needs a little work though, this means tools or mining coming soon!)
NameTags
pause menu(A little work still on it to pause.)
name tag color
sprinting
tint packs(tints everything 1 color)
apple(the red circle and it restores your lives back to 10 and in a later update when you touch it and eat it, it will be removed)
]]–

–Experamrntal:

–[[
Crafting and Crafting GUI
]]–

–Update thoughts:

–[[ moving clouds
tools
ather
mining
monsters
invintory
crafting GUI and crafting tables(working on the crafting GUI, crafting tables coming soon! possibly 4.0 through 5.1)
more blocks
better animations
commands(can be toggled in the options menu)
animals
TNT
fire
flint and steel
weather(when weather first comes out it will just have rain)
stars
saving the data on your lives(im working on it! :slight_smile:
creative mod
sneaking
moon
neather(most simple because a big neather can cause heavy lag on low memory devices and single core prossecors too)
more foods
]]–

–Never to add:

–[[

Muti player is impossible to add… :frowning: sorry for the incovenience but, seariously, im doing this in Lua 5.1…

3D UI INTERFACE
]]–

–Bug fixes:

–[[ no fixed
]]–

–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)

parameter.text(“Username”, “Steve”)

parameter.color(“NameTagColor”, 255)

parameter.integer(“GameMode”, 0, 1, 0)

parameter.boolean(“BlueTintPack”, false)

rsw = math.random(100, 300)

rsh = math.random(50, 100)

rsx = math.random(0, 700)

appleSpawn = 0

dirt = {}

grass = {}

table.insert(dirt, 1)

version = “0.3.1 beta”

lives = 10

supportedOrientations(LANDSCAPE_ANY)

end

function draw()

background(0, 0, 0, 255)

Play:draw()

end

function touched(t)

   if t.x >949 and t.x <1004 and t.y >494 and t.y <504 then

    p.x = p.x + 5

    end

    if t.x >0 and t.x <23 and t.y >494 and t.y <504 then

        p.x = p.x - 5

end

if t.x >0 and t.x <23 and t.y >294 and t.y <304 then

    p.x = p.x - 10

end

if t.x >949 and t.x <1004 and t.y >294 and t.y <304 then

    p.x = p.x + 10

end

if p.x >=599 and p.x <=607 then

    lives = 10

end

end

–# Play

Play = class()

function Play:draw()

background(0, 0, 0, 255)

if BlueTintPack == true then

    tint(0, 16, 255, 255)

else

    tint(255, 255, 255, 255)

end

if sun.y >= 750 then

background(0, 0, 0, 255)

sun.y = -200

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

if BlueTintPack == true then

fill(58, 82, 176, 255)

else

fill(116, 73, 31, 255)

end

for i = 1,10 do

rect(100 * i, 0, 100, 100)

end

–Username tag

fill(NameTagColor)

text(“” …Username, p.x , 255)

--Steve!

sprite("Documents:Steve", p.x, 185, 100, 110)

--Head

– fill(180, 154, 80, 255)

--rect(p.x, 250, 70, 70)

--Body

– fill(0, 0, 255, 255)

if p.x >1000 then

p.x = 400

for i = 1,1 do

    sound(SOUND_HIT, 41660)

    lives = lives - 1

end

end

if p.x <100 then

p.x = 400

for i = 1,1 do

    sound(SOUND_HIT, 41660)

    lives = lives - 1

end

end

–fill(127, 127, 127, 90)

–rect(300, 300, 70, 70)

–fill(255, 255, 255, 255)

–text(“Craft”, 330, 330)

–if CurrentTouch.x >294 and CurrentTouch.x <374 and CurrentTouch.y >294 and CurrentTouch.y <374 then

– Craft:draw()

–end

–Inventory/hotbar

fill(127, 127, 127, 107)

rect(700, 600, 70, 70)

rect(800, 600, 70, 70)

for i = 1,lives do

sprite("Planet Cute:Heart", 70 * i, 600, 50, 50)

end

–Sun

fill(243, 255, 0, 255)

rect(600, 0 + sun.y, 300, 300)

sun.y = sun.y + 0.3

appleSpawn = appleSpawn + 1

if appleSpawn >=500 then

fill(255, 0, 0, 255)

ellipse(600, 150, 40)

end

--Grass top

if BlueTintPack == true then

    fill(0, 76, 255, 255)

else

fill(0, 255, 0, 255)

end

rect(100, 100, 1000, 30)

--Controls

sprite("Cargo Bot:Command Left", 15, 500)

sprite("Cargo Bot:Command Right", 1000, 500)

tint(196, 30, 30, 255)

sprite("Cargo Bot:Command Left", 15, 300)

sprite("Cargo Bot:Command Right", 1000, 300)

if lives == 0 then

    restart()

end

fill(127, 127, 127, 113)

rect(830, 730, 50, 50)

fill(255, 255, 255, 255)

text(“||”, 850, 750)

if CurrentTouch.x >=824 and CurrentTouch.x <=874 and CurrentTouch.y >=724 and CurrentTouch.y <=784 then

background(127, 127, 127, 0)

fill(198, 193, 193, 255)

text("Paused", 400, 600)

fill(255, 255, 255, 255)

text(“Touch to resume”, 500, 500)

end

end

function Play:touched(touch)

end

–# Craft

Craft = class()

function Craft:draw()

background(123, 104, 30, 255)

fill(87, 255, 0, 255)

rect(400, 500, 100, 100)

fill(255, 255, 255, 255)

text(“Grass”, 400, 470)

fill(127, 127, 127, 128)

rect(600, 600, 70, 70)

fill(255, 255, 255, 255)

text(“CRAFT”, 630, 630)

end

function Craft:touched(touch)

if touch.x >594 and touch.x <674 and touch.y >594 and touch.y <674 then

craft()

end

end

function craft()

table.insert(grass, 1)

table.remove(dirt)

displayMode(STANDARD)

print("Crafted!")

end

@code_maker

When you post code, it is totally unreadable. Please put three ~~~ on a line before, and after, the code, to format it properly. (Don’t put code on the same line as ~).

As your program is getting long, I suggest you set up a Gist account (gist.github.com) where you can store your code, then post the link on the forum here. People can then copy your code from the gist.

Ok thanks ignatz! I’m also gonna get a gist account for the 0.4 release, I’m adding a start to crafting and I’m adding building along with a neather! (already got the crafting and building done, now for the neather) but, you can’t mannualy build yet… There is a button for building right now… It’s already like 300 somthing lines long…

@Ignatz Gisthub got me cunfused badly so I tryed pastebin and I said I would need to pay for accualy use, but, I found another website for 4.0… It’s codepad


http://codepad.org/tly5pKwy

Sorry guys, didnt realize that you can’t come back from the neather… I’m working on 4.1 and I’m adding a new block called the ‘NeatherBack’, it’s a way to get back from the neather… =D

4.1 came out for fixes:
Can’t exit the building menu after you craft the neather portal(I just pasted the code under the statement: ‘if obsidian ==3 then’ so, I fixed that, I also added the neatherBack(a way to get back from the neather, it’s the blinking thing in the neather behind the sun’s X quardnets) and I added a little bounus feature, a red circle as a cursor

http://codepad.org/s3IMWGgS

I’m gonna add all the features in the section update thoughts before the 1.0 release. So that’s why I’m doing stuff like 0.3.1 not for fixes but new features, so, expect 0.4.2! Also, why every update is coming every few hours is because Im slowly adding features… Now to start my work on 0.4.2, I will try for WEATHER!!! :slight_smile:

Hola Mola! Ores and picks(or at least I’ve done the variables). I hope I can speed up the release. I am doing coal,iron,gold,diamond,emeral,and redstone ores. They value nothing though until I add sticks, mineble trees, and underground. At least you can mine the ores! :slight_smile: But, I can think of a starting UI for an option to play creative/survival. If I do add creative, you can only fly… But, at least it is a start.

Oh yhea, I also finished player levels. The best part is that is saves your level.

I’m getting lost in new features too easily. I took most of my attention off of the picks and ores to develop a start screen, creative mode,survival mode,and flying in creative mode. And I also made a new pause menu. The new pause is still a WIP(work in progress). You can only resume the game, and if you enter that screen more than once, it will flip and you can’t click back to the normal screen. Time to work on the picks and ores again! The new version 0.5.0 should be here in about 2 days! Veiw this every day! :wink:

It’s here, the update. New features: iron ore(more ores coming soon!) pickaxes, iron ingots(have no use at the moment, 0.6.0 will give them 1 use…) a starting screen, creative mode(no infininte block yet…) survival mode, flying in creative mode. Mining ores(ores only…, I will try for mining the ground in 0.6)and last, a new pause menu for survival(a but buggy, back to title won’t work… :confused: ). HOPE YOU WILL ENJOY PLAYING THIS AWSOME UPDATE!

Link to code:
http://codepad.org/OpRATFtc