whoosh animation when level up pending
This commit is contained in:
		| @@ -157,6 +157,7 @@ function init_hpcols() | ||||
| end | ||||
|  | ||||
| function wipe_level() | ||||
|  xpwhoosh = nil | ||||
|  primary_ship = player.new() | ||||
|  init_hpcols() | ||||
|  pships = linked_list.new() | ||||
| @@ -251,6 +252,17 @@ function updategame() | ||||
| 	  state = win | ||||
| 	end | ||||
| 	if (not pships.next) state = lose | ||||
|  | ||||
|  if primary_ship.xp >= primary_ship.xptarget then | ||||
|   if not xpwhoosh then | ||||
|    xpwhoosh = 0 | ||||
|   else | ||||
|    xpwhoosh += 1 | ||||
|    if (xpwhoosh > 60) xpwhoosh = 0 | ||||
|   end | ||||
|  else | ||||
|   xpwhoosh = nil | ||||
|  end | ||||
| end | ||||
|  | ||||
| function _draw() | ||||
| @@ -346,8 +358,18 @@ function drawhud() | ||||
|  print("XP",119,55,1) | ||||
|  print("HP",114,122,1) | ||||
|  fillp(0x5a5a) | ||||
|  vertmeter(115,58,118,117,primary_ship.xp, primary_ship.xptarget, powcols) | ||||
|  -- 59 px vertically | ||||
|  if xpwhoosh then | ||||
|   clip(115,58,4,60) | ||||
|   rectfill(115,58,118,117,0xaa) | ||||
|   local voff = 5*xpwhoosh+6 | ||||
|   rectfill(115,118-voff,118,117-voff+10,0xbb) | ||||
|   rectfill(115,118-voff+11,118,117-voff+20,0xba) | ||||
|   clip() | ||||
|  else | ||||
|   vertmeter(115,58,118,117,primary_ship.xp, primary_ship.xptarget, powcols) | ||||
|  end | ||||
|  -- 59 px vertically? or 60? off-by-1 error somewhere here or in vertmeter? | ||||
|  -- it's here. I think | ||||
|  local mxs, cs, mxh, ch = primary_ship.maxshield, primary_ship.shield, primary_ship.maxhp, primary_ship.hp | ||||
|  if (mxs > 0) and (mxh > 0) then | ||||
|   local split = 59 * (mxs / (mxs + mxh)) \ 1 + 64 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user