Future Creators

Welcome to the page for Future Creators! Each week I’m going to add more stuff to this page, including whatever things we’re working on that week. If you guys ever need or want some help, throw me an email – megajenius at gmail dot com.

Week One

Example 1:

 print("Hello World!")

Example 2:

 display.newText("Hello World", 100, 100, nil, 50)

Example 3:

 text = display.newText("Hello World", 100, 100, nil, 50)
 text:setTextColor(255, 0, 0)

Example 4:

 w = display.contentWidth
 h = display.contentHeight
 text = display.newText("Hello World", 100, 100, nil, 50)
 text:setTextColor(255, 0, 0)
 text.x = w/2
 text.y = h/2

Example 5:

 a = math.random(1, 10)
 print(a)

Example 6:

 w = display.contentWidth
 h = display.contentHeight
 text = display.newText("Hello World", 100, 100, nil, math.random(20, 100))
 text:setTextColor(255, 0, 0)
 text.x = w/2
 text.y = h/2

Example 7:

 w = display.contentWidth
 h = display.contentHeight
 text = display.newText("Hello World", 100, 100, nil, math.random(20, 100))
 text:setTextColor(math.random(0, 255), math.random(0, 255), math.random(0, 255))
 text.x = w/2
 text.y = h/2

Week Two

Example 1:

display.newRect(100, 100, 100, 100)

Example 2:

myRectangle = display.newRect(100, 100, 100, 100)
myRectangle:setFillColor(255, 255, 0)

Example 3:

myRectangle = display.newRect(100, 100, 100, 100)
myRectangle:setFillColor(math.random(0,255), math.random(0,255), math.random(0,255))

Example 4:

r1 = display.newRect(100, 100, math.random(1, 500), math.random(1, 500))
r1:setFillColor(math.random(0,255), math.random(0,255), math.random(0,255))

Example 5:

r1 = display.newRect(100, 100, math.random(1, 500), math.random(1, 500))
r2 = display.newRect(200, 200, math.random(1, 500), math.random(1, 500))
r3 = display.newRect(300, 300, math.random(1, 500), math.random(1, 500))

r1:setFillColor(math.random(0,255), math.random(0,255), math.random(0,255))
r2:setFillColor(math.random(0,255), math.random(0,255), math.random(0,255))
r3:setFillColor(math.random(0,255), math.random(0,255), math.random(0,255))

Example 6:

w = display.contentWidth
h = display.contentHeight

display.newText(w, 100, 100, nil, 50)
display.newText(h, 100, 200, nil, 50)

Example 7:

w = display.contentWidth
h = display.contentHeight

r1 = display.newRect(0, 0, w, h)
r1:setFillColor(math.random(0,255), math.random(0,255), math.random(0,255))

Example 8:

w = display.contentWidth
h = display.contentHeight

r1 = display.newRect(0, 0, 400, 400)
r1.x = w/2
r1.y = h/2
r1:setFillColor(math.random(0,255), math.random(0,255), math.random(0,255))

Week Three

Example 1:

bob = 1
print(bob)

Example 2:

a = 1
b = 2
c = 3

result = a + b
print(result)
-- a - b, a * b, a / b

Example 3:

a = 1
b = 2
c = 3
result = a * b + c - a / b

Example 4:

name = "Eoghan"

print(name)

Example 5:

name = "Eoghan"
w = display.contentWidth
h = display.contentHeight

text = display.newText(name, 0, 0, nil, 50)
text.x = w/2
text.y = h/2

Example 6:

name = "Eoghan"
color = "red"

sentence = name..color

text = display.newText(sentence, 0, 0, nil, 50)
text.x = w/2
text.y = h/2

Example 7:

name = "Eoghan"
age = 99

sentence = name.." is "..age.." years old."

text = display.newText(sentence, 0, 0, nil, 50)
text.x = w/2
text.y = h/2

Example 8:

name = "Eoghan"
age = 99

age = age + 1

sentence = name.." is "..age.." years old."

text = display.newText(sentence, 0, 0, nil, 50)
text.x = w/2
text.y = h/2

Week Four

Example 1:

display.setStatusBar(display.HiddenStatusBar)

w = display.contentWidth
h = display.contentHeight

cat = display.newImage( "cat.jpg", 0, 0)
cat.width = w
cat.height = h
cat.x = w/2
cat.y = h/2

Example 2:

display.setStatusBar(display.HiddenStatusBar)

w = display.contentWidth
h = display.contentHeight

a = "Red"
r = display.newRect(0, 0, w, h)

if a == "Red" then
    r:setFillColor(255, 0, 0)
else if a == "Blue" then
    r:setFillColor(0, 255, 0)
else if a == "Green" then
    r:setFillColor(0, 0, 255)
else
    r:setFillColor(255, 255, 255)
end

Week Five

Example 1:

display.setStatusBar(display.HiddenStatusBar)
w = display.contentWidth
 h = display.contentHeight
function bloop()
 print("BLOOP!")
 end
bloop()

Example 2:

display.setStatusBar(display.HiddenStatusBar)
w = display.contentWidth
 h = display.contentHeight
function bloop(word)
 print("BLOOP!")
 print("IS!")
 print(word)
 end
bloop("STUPID!")
 bloop("SILLY!")

Example 3:

display.setStatusBar(display.HiddenStatusBar)
 w = display.contentWidth
 h = display.contentHeight
name = "Eoghan"
 age = 99
function aboutMe(nameIn, ageIn)
 print("MY NAME:")
 print(nameIn)
 print("MY AGE:")
 print(ageIn)
 end
aboutMe("Tom", 30)

Example 4:

display.setStatusBar(display.HiddenStatusBar)
 w = display.contentWidth
 h = display.contentHeight
 name = "Eoghan"
 age = 99
 function aboutMe(nameIn, ageIn)
 print("MY NAME:")
 print(nameIn)
 print("MY AGE:")
 print(ageIn)
 end
function birthday()
 age = age + 1
 end
aboutMe(name, age)
 birthday()
 aboutMe(name, age)

Example 5:

display.setStatusBar(display.HiddenStatusBar)
 w = display.contentWidth
 h = display.contentHeight
function block()
 r = display.newRect(0, 0, 100, 100)
 r.x = math.random(0, w)
 r.y = math.random(0, h)
 r:setFillColor(math.random(0, 255), math.random(0, 255), math.random(0, 255))
 end
block()
 block()
 block()

Example 6:

display.setStatusBar(display.HiddenStatusBar)
 w = display.contentWidth
 h = display.contentHeight
r = display.newRect(0, 0, 100, 100)
function tapped()
 r:setFillColor(255, 0, 0)
 end
r:addEventListener("tap", tapped)

Example 7:

display.setStatusBar(display.HiddenStatusBar)
 w = display.contentWidth
 h = display.contentHeight
r = display.newRect(0, 0, 100, 100)
 r.x = w/2
 r.y = h/2
function tapped()
 if r.isVisible then
 r.isVisible = false
 else
 r.isVisible = true
 end
 end
Runtime:addEventListener("tap", tapped)

Example 8:

display.setStatusBar(display.HiddenStatusBar)
 w = display.contentWidth
 h = display.contentHeight
function tapped(e)
 r = display.newRect(0, 0, 100, 100)
 r.x = e.x
 r.y = e.y
 r:setFillColor(math.random(0, 255), math.random(0, 255), math.random(0, 255))
 end
Runtime:addEventListener("tap", tapped)

To be continued…

Week Six

Switching from Menu to Game

display.setStatusBar(display.HiddenStatusBar)
w = display.contentWidth
h = display.contentHeight
--Main Menu Stuff
bg = display.newRect(0, 0, w, h)
bg:setFillColor(0, 255, 0)
rect1 = display.newRect(0, 0, 200, 60)
rect1.x = w/2
rect1.y = h/4
rect1:setFillColor(255, 0, 0)
rect2 = display.newRect(0, 0, 200, 60)
rect2.x = w/2
rect2.y = h/2
rect2:setFillColor(255, 0, 255)
rect3 = display.newRect(0, 0, 200, 60)
rect3.x = w/2
rect3.y = 3*(h/4)
rect3:setFillColor(0, 0, 255)
gamebg = display.newRect(0, 0, w, h)
gamebg:setFillColor(255, 255, 0)
gamebg.isVisible = false
gamerect1 = display.newRect(0, 0, 100, 100)
gamerect1.x = w/2
gamerect1.y = h/4
gamerect1.isVisible = false
gamerect2 = display.newRect(0, 0, 100, 100)
gamerect2.x = w/2
gamerect2.y = 3*(h/4)
gamerect2.isVisible = false
function turnOnGame()
 gamebg.isVisible = true
 gamerect1.isVisible = true
 gamerect2.isVisible = true
end
function turnOffMenu()
 bg.isVisible = false
 rect1.isVisible = false
 rect2.isVisible = false
 rect3.isVisible = false
end
function redTap()
 turnOffMenu()
 turnOnGame()
end
function pinkTap()
 turnOffMenu()
end
function blueTap()
 turnOffMenu()
end
rect1:addEventListener("tap", redTap)
rect2:addEventListener("tap", pinkTap)
rect3:addEventListener("tap", blueTap)

To be continued…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s