[Help] Player health and powerups

This is the place for discussion and support for LunaLua and related modifications and libraries.
Forum rules
Before you make a topic/post, consider the following:
-Is there a topic for this already?
-Is your post on topic/appropriate?
-Are you posting in the right forum/following the forum rules?
SMB3
Rex
Rex
Posts: 32
Joined: Thu May 22, 2014 8:12 pm

[Help] Player health and powerups

Postby SMB3 » Tue May 24, 2016 8:10 pm

So a while ago, I made a post about using LunaDLL to force powerups. Since I can't commit to anything, it's been a while and I'm just now continuing research (didn't help that when I found out about LunaLua, it wasn't letting me download it).
It was dumb. I hadn't heard of LunaLua.
LL has made it much easier to do what I was trying to do; I have now given the player the ability to pick up an ice flower at will by hitting shift. I still have another problem, though; I still want health to be separate. I initially had the idea to create a variable, initialize it as equal to the player's current health, give them the powerup, then set their HP back to what it was using said variable. The problem is, in searching these pages, I couldn't find any constants I could use (or figure out how to use) to get/set the HP. Alternatively I could set a separate counter, and simply have that change when hits or at-will powerups are detected, but then I run into another problem. The hearts at the top of the screen would be meaningless and confusing, and I'd want to get rid of them, but I also need to find a nice-looking way to display the new health counter.

I'm also encountering a bug (I believe it was mentioned in a post I saw, or maybe on the PGE wiki) where, when using onLoop() to set the player's powerup if it's not what it's supposed to be, they phase through the floor if it happens while they're taking damage. If anyone has a tip for that, I could use it. Thanks!

S1eth
Swooper
Swooper
Posts: 54
Joined: Sat Apr 23, 2016 10:44 am

Re: [Help] Player health and powerups

Postby S1eth » Tue May 24, 2016 8:34 pm

This might be useful: http://www.wohlsoft.ru/pgewiki/HUDofTime.lua

Either use this directly, or study the code.

PixelPest
Raccoon Mario
Raccoon Mario
Posts: 7111
Joined: Sun Jul 12, 2015 5:38 pm
Flair: Tamer of Boom Booms
Contact:

Re: [Help] Player health and powerups

Postby PixelPest » Tue May 24, 2016 9:04 pm

For the second issue you can constantly keep a variable containing the int value of the player's power-up and when it changes set the player's position in the x to their current position plus 32 or 64, depending on how far they're dropping into the floor

Emral
Cute Yoshi Egg
Cute Yoshi Egg
Posts: 9722
Joined: Mon Jan 20, 2014 12:58 pm
Flair: Phoenix

Re: [Help] Player health and powerups

Postby Emral » Wed May 25, 2016 1:34 am

PixelPest wrote:For the second issue you can constantly keep a variable containing the int value of the player's power-up and when it changes set the player's position in the x to their current position plus 32 or 64, depending on how far they're dropping into the floor
That won't work and would be a hacky solution if you said "y".

There's a player offset for forced animation states (0x122). That's, amongst other things, the flicker for collecting a powerup. If the player loses their powerup, they'll sink the difference of their hitbox into the ground. What you ideally wanna do is skip all of that. Hoeloe has a solution for Link in HUDofTime.


Return to “LunaLua”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari