Advertisement
alestane

Untitled

Feb 11th, 2012
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. func.f_updatePoints = function(amnt)
  2.         -- first make sure that the previous points display is removed --
  3.         if g_gui and g_gui.pointsText then
  4.                 if g_gui.pointsText.parent then
  5.                         display.remove(g_gui.pointsText);
  6.         end
  7.         g_gui.pointsText = nil;
  8.         end
  9.  
  10.         data.points = data.points + amnt;
  11.         local points = display.newRetinaText("PTS: "..data.points,265,13,"Lovely Eunike Hans",16);
  12.         points:setReferencePoint(display.TopLeftReferencePoint);
  13.         points.x = 360;
  14.         points.y = 20;
  15.         points.alpha = 0;
  16.         g_gui:insert(points);
  17.         g_gui.pointsText = points;
  18.  
  19.         -- animate it --
  20.     timer:newTransition(points,{time=300,alpha = 1,y=30,onComplete = function(points)
  21.         timer:newTransition(points, {delay=400,time=300,y=50,alpha = 0,onComplete=function(points)
  22.             if points.parent then
  23.                 points.parent.pointsText = nil
  24.                 display.remove(points)
  25.             end
  26.         });
  27.     });
  28. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement