Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 801 lines (605 sloc) 19.474 kb
c9bbaad David McCuskey First Check-in
dmccuskey authored
1 --====================================================================--
2 -- hud_objects.lua
3 --
4 -- by David McCuskey
5 --
6 -- Sample code is MIT licensed, the same license which covers Lua itself
7 -- http://en.wikipedia.org/wiki/MIT_License
8 -- Copyright (C) 2011 David McCuskey. All Rights Reserved.
9 -- Copyright (C) 2010 ANSCA Inc. All Rights Reserved.
10 --====================================================================--
11
12 --====================================================================--
13 -- Imports
14 --====================================================================--
15
16 local Objects = require( "dmc_objects" )
17 local Utils = require( "dmc_utils" )
18 local Buttons = require( "dmc_buttons" )
19 local BinaryButton = Buttons.BinaryButton
20 --local facebook = require( "facebook" )
21
22 -- setup some aliases to make code cleaner
23 local inheritsFrom = Objects.inheritsFrom
24 local CoronaBase = Objects.CoronaBase
25
26
27 --====================================================================--
28 -- Setup, Constants
29 --====================================================================--
30
31 local tapSound = audio.loadSound( "assets/sounds/tapsound.wav" )
32
33
34 --====================================================================--
35 -- Support Functions
36 --====================================================================--
37
38 -- comma_value()
39 --
40 local function comma_value( amount )
41 local formatted = amount
42 while true do
43 formatted, k = string.gsub( formatted, "^(-?%d+)(%d%d%d)", '%1,%2' )
44 if ( k==0 ) then
45 break
46 end
47 end
48
49 return formatted
50 end
51
52
53 --====================================================================--
54 -- Load Screen HUD class
55 --====================================================================--
56
57 local LoadScreenHUD = inheritsFrom( CoronaBase )
58 LoadScreenHUD.NAME = "Load Screen HUD"
59
60 LoadScreenHUD.BAR_WIDTH = 300
61 LoadScreenHUD.BAR_HEIGHT = 10
62
63 -- _init()
64 --
65 -- one of the base methods to override for dmc_objects
66 --
67 function LoadScreenHUD:_init( options )
68
69 -- don't forget this !!!
70 self:superCall( "_init" )
71
72 --== Create Properties ==--
73 self.timer = nil
74 self._text = ""
75 self._percentComplete = 0
76 self._refs = {}
77
78 end
79 -- _init()
80 --
81 function LoadScreenHUD:_undoInit()
82 timer.cancel( self.timer )
83 self.timer = nil
84 self.percentComplete = 0
85 Utils.destroy( self._refs )
86 end
87
88 -- _createView()
89 --
90 -- one of the base methods to override for dmc_objects
91 --
92 function LoadScreenHUD:_createView()
93
94 local refs = self._refs
95 local bar_y = 100
96 local img
97
98 img = display.newImageRect( "assets/backgrounds/loading.png", 480, 320 )
99
100 self:insert( img )
101
102 -- loading bar
103 img = display.newRect( 0, 0, LoadScreenHUD.BAR_WIDTH, LoadScreenHUD.BAR_HEIGHT )
104 img.strokeWidth = 0
105 img:setStrokeColor( 0, 0, 0, 0 )
106 img:setFillColor( 255, 255, 255, 255 )
107
108 refs.bar = img
109
110 self:insert( img )
111 img:setReferencePoint( display.CenterLeftReferencePoint )
112 --img.x = ( 480 - LoadScreenHUD.BAR_WIDTH ) / 2 ; img.y = 85
113 img.y = bar_y
114
115 -- loading bar outline
116 img = display.newRect( 0, 0, LoadScreenHUD.BAR_WIDTH, LoadScreenHUD.BAR_HEIGHT )
117 img.strokeWidth = 2
118 img:setStrokeColor( 200, 200, 200, 255 )
119 img:setFillColor( 0, 0, 0, 0 )
120
121 refs.outline = img
122
123 self:insert( img )
124 img.x = 0 ; img.y = bar_y
125
126 end
127 -- _undoCreateView()
128 --
129 function LoadScreenHUD:_undoCreateView()
130 for i=self.display.numChildren, 1, -1 do
131 self.display[ i ]:removeSelf()
132 end
133 end
134
135 -- _initComplete()
136 --
137 function LoadScreenHUD:_initComplete()
138 self.x = 240 ; self.y = 160
139 self:clear()
140 end
141
142 --== Class Methods
143
144
145 -- gameLives
146 --
147 function LoadScreenHUD.__getters:percentComplete()
148 return self._percentComplete
149 end
150 function LoadScreenHUD.__setters:percentComplete( value )
151 local refs = self._refs
152 local width = 480
153
154 -- sanitize
155 if value < 0 then value = 0 end
156 if value > 100 then value = 100 end
157
158 self._percentComplete = value
159
160 -- calculate bar coords
161 local width = LoadScreenHUD.BAR_WIDTH * ( value / 100 )
162
163 if width == 0 then
164 refs.bar.isVisible = false
165 else
166 refs.bar.isVisible = true
167 refs.bar.width = width
168
169 refs.bar.x = - (LoadScreenHUD.BAR_WIDTH / 2 ) - ( LoadScreenHUD.BAR_WIDTH - refs.bar.width ) / 2
170 end
171
172 if self._percentComplete >= 100 then
173 self:dispatchEventComplete()
174 end
175 end
176
177
178 -- clear()
179 --
180 -- initialize load screen to beginnings
181 --
182 function LoadScreenHUD:clear()
183 self.percentComplete = 0
184 self.text = ""
185 end
186
187 -- dispatchEventComplete
188 --
189 function LoadScreenHUD:dispatchEventComplete()
190 --print( "LoadScreenHUD:dispatchEventComplete " )
191
192 self:dispatchEvent( { name="complete" } )
193
194 end
195
196
197 --====================================================================--
198 -- Pause Screen class
199 --====================================================================--
200
201
202 local PauseScreenHUD = inheritsFrom( CoronaBase )
203 PauseScreenHUD.NAME = "Pause Screen"
204
205
206 -- _init()
207 --
208 -- one of the base methods to override for dmc_objects
209 --
210 function PauseScreenHUD:_init( options )
211
212 -- don't forget this !!!
213 self:superCall( "_init" )
214
215 --== Create Properties ==--
216 self._toggleItems = nil
217 self._toggleButton = nil
218 self._pauseIsActive = false
219
220 end
221 -- _undoInit()
222 --
223 function PauseScreenHUD:_undoInit( options )
224 --print( "PauseScreenHUD:_undoInit" )
225 self._toggleItems = nil
226 self._toggleButton = nil
227 self._pauseIsActive = false
228 end
229
230 -- _createView()
231 --
232 -- one of the base methods to override for dmc_objects
233 --
234 function PauseScreenHUD:_createView()
235
236 local img, btn
237 local d = display.newGroup()
238
239 self:insert( d )
240
241 -- shade rectangle
242 img = display.newRect( 0, 0, 480, 320 )
243 img:setFillColor( 0, 0, 0, 255 )
244 img.alpha = 0.5
245
246 d:insert( img )
247 self._toggleItems = d
248
249 -- main menu button
250 btn = Buttons.create( "push", {
251 id="menu-button",
252 width=44, height=44,
253 defaultSrc = "assets/buttons/pausemenubtn.png",
254 downSrc = "assets/buttons/pausemenubtn-over.png",
255 })
256 btn:addEventListener( "touch", Utils.createObjectCallback( self, self.buttonHandler ) )
257
258 d:insert( btn.display )
259 btn.x = 38 ; btn.y = 288
260
261 -- pause button
262 btn = Buttons.create( "toggle", {
263 id="pause-button",
264 width=44, height=44,
265 defaultSrc = "assets/buttons/pausebtn.png",
266 activeSrc = "assets/buttons/pausebtn-over.png",
267 })
268 btn:addEventListener( "touch", Utils.createObjectCallback( self, self.buttonHandler ) )
269
270 self:insert( btn.display )
271 btn.x = 442 ; btn.y = 288
272
273 self.pauseIsActive = ( btn.state == "active" )
274
275 self:hide()
276 end
277 -- _undoCreateView()
278 --
279 function PauseScreenHUD:_undoCreateView()
280 --print( "PauseScreenHUD:_undoCreateView" )
281 for i=self._toggleItems.numChildren, 1, -1 do
282 self._toggleItems[ i ]:removeSelf()
283 end
284 for i=self.display.numChildren, 1, -1 do
285 self.display[ i ]:removeSelf()
286 end
287 end
288
289 -- _initComplete()
290 --
291 function PauseScreenHUD:_initComplete()
292 self:show()
293 end
294 -- _undoInitComplete()
295 --
296 function PauseScreenHUD:_undoInitComplete()
297 self:hide()
298 end
299
300
301 --== Class Methods
302
303
304 -- pauseIsActive
305 --
306 function PauseScreenHUD.__getters:pauseIsActive()
307 return self._pauseIsActive
308 end
309 function PauseScreenHUD.__setters:pauseIsActive( value )
310 self._pauseIsActive = value
311 self._toggleItems.isVisible = value
312 end
313
314
315 function PauseScreenHUD:menuConfirmation( event )
316
317 if "clicked" == event.action then
318 local i = event.index
319 if i == 1 then
320 -- Player clicked Yes, go to main menu
321 self:dispatchEvent( { name="change", label="menu" } )
322 end
323 end
324 end
325
326 function PauseScreenHUD:buttonHandler( event )
327
328 local btn = event.target
329
330 if event.phase == btn.PHASE_RELEASE then
331 audio.play( tapSound )
332
333 -- process menu button
334 if event.id == "menu-button" then
335 local alert = native.showAlert( "Are You Sure?", "Your current game will end.", { "Yes", "Cancel" }, Utils.createObjectCallback( self, self.menuConfirmation ) )
336
337 -- process Pause Button
338 elseif event.id == "pause-button" then
339 --Utils.print( event )
340 self.pauseIsActive = ( event.state == "active" )
341 self:dispatchEvent( { name="change", label="pause", state=event.state } )
342 end
343 end
344
345 return true
346 end
347
348
349
350
351 --====================================================================--
352 -- Game Over HUD class
353 --====================================================================--
354
355
356 local GameOverHUD = inheritsFrom( CoronaBase )
357 GameOverHUD.NAME = "Game Over HUD"
358
359 GameOverHUD.BUTTON_EVENT = "gameOverHUDButtonEvent"
360
361 GameOverHUD.YOU_WIN_SOUND = audio.loadSound( "assets/sounds/youwin.wav" )
362 GameOverHUD.YOU_LOSE_SOUND = audio.loadSound( "assets/sounds/youlose.wav" )
363
364
365 -- _init()
366 --
367 -- one of the base methods to override for dmc_objects
368 --
369 function GameOverHUD:_init( options )
370
371 -- don't forget this !!!
372 self:superCall( "_init" )
373
374 --== Create Properties ==--
375 self._imgRefs = {}
376
377 end
378 -- _undoInit()
379 --
380 function GameOverHUD:_undoInit()
381 print( "GameOverHUD:_undoInit" )
382
383 Utils.destroy( self._imgRefs )
384
385 end
386
387
388 -- _createView()
389 --
390 -- one of the base methods to override for dmc_objects
391 --
392 function GameOverHUD:_createView()
393
394 local img, btn, txt
395 local imgRefs = self._imgRefs
396
397 local d = self.display
398
399 --self:insert( d )
400
401 -- shade rectangle
402 img = display.newRect( 0, 0, 480, 320 )
403 img:setFillColor( 0, 0, 0, 255 )
404 img.alpha = 0.5
405
406 d:insert( img )
407 imgRefs[ "background" ] = img
408
409
410 -- SCORE DISPLAY
411 txt = display.newText( "0", 470, 22, "Helvetica-Bold", 52 )
412 txt:setTextColor( 255, 255, 255, 255 ) --> white
413 txt.xScale = 0.5; txt.yScale = 0.5 --> for clear retina display text
414 --txt.x = ( 480 - ( txt.contentWidth * 0.5 ) ) - 15
415 txt.y = 30
416
417 d:insert( txt )
418 imgRefs[ "score-txt" ] = txt
419
420 -- Best SCORE DISPLAY
421 txt = display.newText( "0", 10, 300, "Helvetica-Bold", 32 )
422 txt:setTextColor( 228, 228, 228, 255 )
423 txt.xScale = 0.5; txt.yScale = 0.5 --> for clear retina display text
424 txt.y = 304
425
426 d:insert( txt )
427 imgRefs[ "bestscore-txt" ] = txt
428
429 -- Open Feint button
430 btn = Buttons.create( "push", {
431 id="openfeint-button",
432 width=168, height=40,
433 defaultSrc = "assets/buttons/openfeintbtn.png",
434 downSrc = "assets/buttons/openfeintbtn-over.png",
435 })
436 btn.x = 168 ; btn.y = 110
437 d:insert( btn.display )
438 imgRefs[ "openfeint-btn" ] = btn
439
440 imgRefs[ "openfeint-btn-func" ] = Utils.createObjectCallback( self, self.openFeintButtonHandler )
441 btn:addEventListener( "touch", imgRefs[ "openfeint-btn-func" ] )
442
443
444 -- Facebook button
445 btn = Buttons.create( "push", {
446 id="facebook-button",
447 width=302, height=40,
448 defaultSrc = "assets/buttons/facebookbtn.png",
449 downSrc = "assets/buttons/facebookbtn-over.png",
450 })
451 btn.x = 240 ; btn.y = 220
452 d:insert( btn.display )
453 imgRefs[ "facebook-btn" ] = btn
454
455 imgRefs[ "facebook-btn-func" ] = Utils.createObjectCallback( self, self.facebookButtonHandler )
456 btn:addEventListener( "touch", imgRefs[ "facebook-btn-func" ] )
457
458
459 -- "you win" background
460 img = display.newImageRect( "assets/backgrounds/youwin.png", 390, 154 )
461 img.x = 240 ; img.y = 165
462 img.isVisible = true
463
464 d:insert( img )
465 imgRefs[ "win" ] = img
466
467 -- "you lose" background
468 img = display.newImageRect( "assets/backgrounds/youlose.png", 390, 154 )
469 img.x = 240 ; img.y = 165
470 img.isVisible = true
471 d:insert( img )
472
473 imgRefs[ "lose" ] = img
474
475 -- menu button
476 btn = Buttons.create( "push", {
477 id="menu-button",
478 width=60, height=60,
479 defaultSrc = "assets/buttons/menubtn.png",
480 downSrc = "assets/buttons/menubtn-over.png",
481 })
482 btn.x = 0 ; btn.y = 186
483 d:insert( btn.display )
484 imgRefs[ "menu-btn" ] = btn
485
486 imgRefs[ "menu-btn-func" ] = Utils.createObjectCallback( self, self.buttonHandler )
487 btn:addEventListener( "touch", imgRefs[ "menu-btn-func" ] )
488
489
490 -- restart button
491 btn = Buttons.create( "push", {
492 id="restart-button",
493 width=60, height=60,
494 defaultSrc = "assets/buttons/restartbtn.png",
495 downSrc = "assets/buttons/restartbtn-over.png",
496 })
497 d:insert( btn.display )
498 btn.x = 0 ; btn.y = 186
499 imgRefs[ "restart-btn" ] = btn
500
501 imgRefs[ "restart-btn-func" ] = Utils.createObjectCallback( self, self.buttonHandler )
502 btn:addEventListener( "touch", imgRefs[ "restart-btn-func" ] )
503
504
505 -- next button
506 btn = Buttons.create( "push", {
507 id="nextlevel-button",
508 width=60, height=60,
509 defaultSrc = "assets/buttons/nextlevelbtn.png",
510 downSrc = "assets/buttons/nextlevelbtn-over.png",
511 })
512 d:insert( btn.display )
513 btn.x = 0 ; btn.y = 186
514 imgRefs[ "nextlevel-btn" ] = btn
515
516 imgRefs[ "nextlevel-btn-func" ] = Utils.createObjectCallback( self, self.buttonHandler )
517 btn:addEventListener( "touch", imgRefs[ "nextlevel-btn-func" ] )
518
519 end
520 -- _undoCreateView()
521 --
522 function GameOverHUD:_undoCreateView()
523 print( "GameOverHUD:_undoCreateView" )
524
525 local imgRefs = self._imgRefs
526 local o
527
528 -- next button
529 o = imgRefs[ "nextlevel-btn" ]
530 o:removeEventListener( "touch", imgRefs[ "nextlevel-btn-func" ] )
531 self:remove( o.display )
532 imgRefs[ "nextlevel-btn" ] = nil
533 imgRefs[ "nextlevel-btn-func" ] = nil
534
535 -- restart button
536 o = imgRefs[ "restart-btn" ]
537 o:removeEventListener( "touch", imgRefs[ "restart-btn-func" ] )
538 self:remove( o.display )
539 imgRefs[ "restart-btn" ] = nil
540 imgRefs[ "restart-btn-func" ] = nil
541
542 -- menu button
543 o = imgRefs[ "menu-btn" ]
544 o:removeEventListener( "touch", imgRefs[ "menu-btn-func" ] )
545 self:remove( o.display )
546 imgRefs[ "menu-btn" ] = nil
547 imgRefs[ "menu-btn-func" ] = nil
548
549 -- you lose bg
550 o = imgRefs[ "lose" ]
551 self:remove( o )
552 imgRefs[ "lose" ] = nil
553
554 -- you win bg
555 o = imgRefs[ "win" ]
556 self:remove( o )
557 imgRefs[ "win" ] = nil
558
559 -- facebook button
560 o = imgRefs[ "facebook-btn" ]
561 o:removeEventListener( "touch", imgRefs[ "facebook-btn-func" ] )
562 self:remove( o.display )
563 imgRefs[ "facebook-btn" ] = nil
564 imgRefs[ "facebook-btn-func" ] = nil
565
566 -- open feint button
567 o = imgRefs[ "openfeint-btn" ]
568 o:removeEventListener( "touch", imgRefs[ "openfeint-btn-func" ] )
569 self:remove( o.display )
570 imgRefs[ "openfeint-btn" ] = nil
571 imgRefs[ "openfeint-btn-func" ] = nil
572
573 -- best score display
574 o = imgRefs[ "bestscore-txt" ]
575 self:remove( o )
576 imgRefs[ "bestscore-txt" ] = nil
577
578 -- score display
579 o = imgRefs[ "score-txt" ]
580 self:remove( o )
581 imgRefs[ "score-txt" ] = nil
582
583 -- shade rectangle
584 o = imgRefs[ "background" ]
585 self:remove( o )
586 imgRefs[ "background" ] = nil
587
588 end
589
590 -- _initComplete()
591 --
592 function GameOverHUD:_initComplete()
593 --self:show( { outcome="win", bestScore=10234, score=1235 } )
594 --self:show( { outcome="lose", bestScore=10234, score=1235 } )
595 self:hide()
596 end
597
598
599 --== Class Methods
600
601
602 -- "win" / "lose"
603 function GameOverHUD:show( params )
604
605 self:superCall( "show" )
606
607 local imgRefs = self._imgRefs
608 local btnPadding = 72
609 local outcome = params.outcome
610 local bestScore = params.bestScore
611 local score = params.score
612
613 -- WE WON !!
614 if outcome == "win" then
615 audio.play( GameOverHUD.YOU_WIN_SOUND )
616 imgRefs[ "win" ].isVisible = true
617 imgRefs[ "lose" ].isVisible = false
618
619 imgRefs[ "menu-btn" ].x = 227
620
621 -- Score Text
622 local scoreTxt = imgRefs[ "score-txt" ]
623 scoreTxt.text = "Score: " .. comma_value( score )
624 timer.performWithDelay( 1000, function() scoreTxt.isVisible = true; end, 1 )
625 scoreTxt.x = ( 480 - ( scoreTxt.contentWidth * 0.5 ) ) - 15
626
627 -- Next Level Button
628 imgRefs[ "nextlevel-btn" ].isVisible = true
629 imgRefs[ "nextlevel-btn" ].alpha = 0
630 transition.to( imgRefs[ "nextlevel-btn" ], { time=500, alpha=1 } )
631
632 -- Facebook Button
633 imgRefs[ "facebook-btn" ].isVisible = true
634 transition.to( imgRefs[ "facebook-btn" ], { time=500, alpha=1, y=255, transition=easing.inOutExpo } )
635
636 -- WE LOST
637 elseif outcome == "lose" then
638 audio.play( GameOverHUD.YOU_LOSE_SOUND )
639 imgRefs[ "win" ].isVisible = false
640 imgRefs[ "lose" ].isVisible = true
641
642 -- Facebook Button
643 imgRefs[ "facebook-btn" ].isVisible = true
644
645 imgRefs[ "nextlevel-btn" ].isVisible = false
646 imgRefs[ "menu-btn" ].x = 266
647 end
648
649 -- Background
650 imgRefs[ "background" ].alpha = 0
651 transition.to( imgRefs[ "background" ], { time=200, alpha=0.65 } )
652
653 -- Score Text
654 imgRefs[ "score-txt" ].isVisible = false
655
656 -- Best Score Text
657 local bestScoreTxt = imgRefs[ "bestscore-txt" ]
658 bestScoreTxt.text = "Best Score For This Level: " .. comma_value( bestScore )
659 bestScoreTxt.x = ( bestScoreTxt.contentWidth * 0.5 ) + 15
660
661 -- Game Over image
662 imgRefs[ outcome ].alpha = 0
663 transition.to( imgRefs[ outcome ], { time=500, alpha=1 } )
664
665 -- Menu Button (must be before Restart)
666 imgRefs[ "menu-btn" ].alpha = 0
667 transition.to( imgRefs[ "menu-btn" ], { time=500, alpha=1 } )
668
669 -- Restart Button (must be before Next Level)
670 imgRefs[ "restart-btn" ].x = imgRefs[ "menu-btn" ].x + btnPadding
671 imgRefs[ "restart-btn" ].alpha = 0
672 transition.to( imgRefs[ "restart-btn" ], { time=500, alpha=1 } )
673
674 -- Next Level Button
675 imgRefs[ "nextlevel-btn" ].x = imgRefs[ "restart-btn" ].x + btnPadding
676
677 -- Facebook Button
678 imgRefs[ "facebook-btn" ].alpha = 0
679
680 -- Open Feint Button
681 imgRefs[ "openfeint-btn" ].alpha = 0
682 transition.to( imgRefs[ "openfeint-btn" ], { time=500, alpha=1, y=68, transition=easing.inOutExpo } )
683
684 end
685
686 -- "win" / "lose"
687 function GameOverHUD:hide( outcome )
688
689 self:superCall( "hide" )
690
691 self._imgRefs[ "win" ].isVisible = false
692 self._imgRefs[ "lose" ].isVisible = false
693
694 end
695
696
697 function GameOverHUD:buttonHandler( event )
698 --print( "GameOverHUD:buttonHandler" )
699
700 local btn = event.target
701
702 if event.phase == btn.PHASE_RELEASE then
703 audio.play( tapSound )
704
705 local e = {
706 name=GameOverHUD.BUTTON_EVENT,
707 id = event.id,
708 }
709 -- Menu button
710 if event.id == "menu-button" then
711 self:doDispatchEvent( e )
712
713 -- Restart Button
714 elseif event.id == "restart-button" then
715 self:doDispatchEvent( e )
716
717 -- Next Level Button
718 elseif event.id == "nextlevel-button" then
719 self:doDispatchEvent( e )
720
721 end -- if event.id
722 end -- if event.phase
723
724 return true
725 end
726
727 function GameOverHUD:doDispatchEvent( e )
728 self:dispatchEvent( e )
729 end
730
731 function GameOverHUD:openFeintButtonHandler( event )
732 print( "GameOverHUD:openFeintButtonHandler" )
733
734 if event.phase == "release" then
735 audio.play( tapSound )
736
737 -- Launch OpenFeint Leaderboards Panel:
738 --openfeint.launchDashboard("leaderboards")
739 end
740 end
741
742 function GameOverHUD:facebookButtonHandler( event )
743 print( "GameOverHUD:facebookButtonHandler" )
744
745 if event.phase == "release" then
746 audio.play( tapSound )
747
748 -- Code to Post Status to Facebook (don't forget the 'require "facebook"' line at top of module)
749 -- The Code below is fully functional as long as you replace the fbAppID var with valid app ID.
750
751 --[[
752 local fbAppID = "1234567890" --> (string) Your FB App ID from facebook developer's panel
753
754 local facebookListener = function( event )
755 if ( "session" == event.type ) then
756 -- upon successful login, update their status
757 if ( "login" == event.phase ) then
758
759 local scoreToPost = comma_value(gameScore)
760
761 local statusUpdate = "just scored a " .. gameScore .. " on Ghosts v.s Monsters!"
762
763 facebook.request( "me/feed", "POST", {
764 message=statusUpdate,
765 name="Download Ghosts vs. Monsters to Compete with Me!",
766 caption="Ghosts vs. Monsters - Sample app created with the Corona SDK by Ansca Mobile.",
767 link="http://itunes.apple.com/us/app/your-app-name/id382456881?mt=8",
768 picture="http://www.yoursite.com/link-to-90x90-image.png" } )
769 end
770 end
771 end
772
773 facebook.login( fbAppID, facebookListener, { "publish_stream" } )
774 ]]--
775 end
776
777 end
778
779
780 --====================================================================--
781 -- Game Object Factory
782 --====================================================================--
783
784 local HUDFactory = {}
785
786 function HUDFactory.create( param )
787
788 local o
789 if param == "loadscreen-hud" then
790 o = LoadScreenHUD:new()
791 elseif param == "pausescreen-hud" then
792 o = PauseScreenHUD:new()
793 elseif param == "gameover-hud" then
794 o = GameOverHUD:new()
795 end
796 return o
797
798 end
799
800 return HUDFactory
Something went wrong with that request. Please try again.