-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.lua
81 lines (70 loc) · 2.41 KB
/
main.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
display.setStatusBar(display.HiddenStatusBar)
local composer = require("composer")
local widget = require("widget")
Score = 0
over = false
-- game_over_pic = display.newImage("images/blank.png", display.contentCenterX, display.contentCenterY)
local welcome = display.newImage("images/welcome.jpg", display.contentCenterX, display.contentCenterY)
local screen_ratio = display.contentHeight / display.contentWidth
local pic_ratio = welcome.height / welcome.width
if pic_ratio > screen_ratio then
welcome.width = display.contentWidth
welcome.height = welcome.width * pic_ratio
else
welcome.height = display.contentHeight
welcome.width = welcome.height / pic_ratio
end
local character = display.newImage("images/character.png", display.contentCenterX, display.contentCenterY)
character:scale(0.1, 0.1)
local button = widget.newButton {
defaultFile = "images/start_btn.png",
onPress = function(event)
event.target.alpha = 0.75
end,
onRelease = function(event)
event.target.alpha = 1
composer.gotoScene("main_game", { effect = "fade", time = 500 })
end,
x = display.contentCenterX,
y = display.contentCenterY + 125
}
button:scale(0.1, 0.1)
-- local button = widget.newButton {
-- defaultFile = "images/start_btn.png",
-- onPress = function(event)
-- event.target.alpha = 0.75
-- end,
-- onRelease = function(event)
-- event.target.alpha = 1
-- composer.gotoScene("draw_box", { effect = "fade", time = 500 })
-- end,
-- x = display.contentCenterX + 50,
-- y = 100
-- }
-- button:scale(0.01, 0.01)
-- local button = widget.newButton {
-- defaultFile = "images/start_btn.png",
-- onPress = function(event)
-- event.target.alpha = 0.75
-- end,
-- onRelease = function(event)
-- event.target.alpha = 1
-- composer.gotoScene("getcoin", { effect = "fade", time = 500 })
-- end,
-- x = display.contentCenterX + 50,
-- y = 150
-- }
-- button:scale(0.01, 0.01)
-- local button = widget.newButton {
-- defaultFile = "images/start_btn.png",
-- onPress = function(event)
-- event.target.alpha = 0.75
-- end,
-- onRelease = function(event)
-- event.target.alpha = 1
-- composer.gotoScene("tug of war", { effect = "fade", time = 500 })
-- end,
-- x = display.contentCenterX + 50,
-- y = 200
-- }
-- button:scale(0.01, 0.01)