-
Notifications
You must be signed in to change notification settings - Fork 0
/
mapScreen.lua
100 lines (55 loc) · 2.2 KB
/
mapScreen.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
MapScreen = {}
stretched = false
increasedSize = 800
function increaseMapSize()
stretched = nil
mapBackground.x = -400
mapBackground.y = 280
mapBackground.width = 800
mapBackground.height = 700
stretched = true
end
function reduceMapSize()
stretched = nil
mapBackground.x = 0
mapBackground.y = 0
mapBackground.width = 200
mapBackground.height = 200
stretched = false
end
function MapScreen:new()
local group = display.newGroup()
mapContentGroup = display.newGroup()
mapBordersGroup = display.newGroup()
mapBackground = display.newImageRect( "mapBackground.png", 200, 200)
mapBackground:addEventListener('touch',function(event)
if event.phase ~= 'ended' then return end
if stretched == nil then
print("Wait for map to finish resizing before modifying")
else
if stretched == true then
print("Reduce map size")
reduceMapSize()
else
print("Increase map size")
increaseMapSize()
end
end
end)
group: insert(mapBackground)
--local earthBackground = display.newImageRect( "planetEarth.png", 150, 150)
local mapShip = display.newImageRect( "transparentShip1.png", 10, 10)
--mapContentGroup: insert(earthBackground)
mapBordersGroup: insert(mapContentGroup)
mapBordersGroup.height = 200
mapBordersGroup.width = 200
mapBordersGroup: insert(mapShip)
--mapShip.touch = onMapTouch()
--mapShip:addEventListener( "touch", mapShip )
group: insert(mapBordersGroup)
function group:setPosition(current)
--Update details here
end
return group
end
return MapScreen