Overwriting the Player's Rendering

Post here for help and support regarding LunaLua and SMBX2's libraries and features.
ThEnderYoshiHD
Goomba
Goomba
Posts: 4
Joined: Fri Jan 08, 2016 10:21 am
Pronouns: she/they
Contact:

Overwriting the Player's Rendering

Postby ThEnderYoshiHD » Wed Feb 21, 2024 3:10 pm

I'm making a custom NPC where, under certain conditions, I need to draw the player as their small form and with a shader applied.
Player:render() seems like the way to go, but it doesn't replace the original sprite.

How do I stop the original sprite from being drawn?

Marioman2007
Lakitu
Lakitu
Posts: 466
Joined: Tue Aug 25, 2020 3:19 am
Flair: Dr. Bones
Pronouns: He/Him

Re: Overwriting the Player's Rendering

Postby Marioman2007 » Thu Feb 22, 2024 7:34 am

You can do "player.frame = -50 * player.direction" in onTickEnd or onDraw to hide the vanilla player rendering.
Though you will need to pass a frame number in the player:render call because it uses the vanilla player frame by default.

ThEnderYoshiHD
Goomba
Goomba
Posts: 4
Joined: Fri Jan 08, 2016 10:21 am
Pronouns: she/they
Contact:

Re: Overwriting the Player's Rendering

Postby ThEnderYoshiHD » Thu Feb 22, 2024 12:22 pm

Marioman2007 wrote:
Thu Feb 22, 2024 7:34 am
You can do "player.frame = -50 * player.direction" in onTickEnd or onDraw to hide the vanilla player rendering.
Though you will need to pass a frame number in the player:render call because it uses the vanilla player frame by default.
It worked!
Also I needed to set frame anyway since I wanted a specific frame from a specific powerup.

Image


Return to “LunaLua Help”

Who is online

Users browsing this forum: No registered users and 1 guest

SMWCentralTalkhausMario Fan Games GalaxyKafukaMarioWikiSMBXEquipoEstelari