Help with shield only

Pink Mario

Member
So I have some code for shooting things
but I want to shoot different things depending on your shield
is there anyway to do that?
 
Assuming you're talking about Lua, and that you have a variable named player that holds a player object, you can check the player's current shield by doing something with:
Code:
player.powers[pw_shield]
For example:
Code:
local shield = player.powers[pw_shield]
local thingToFire = MT_REDRING

if shield == SH_PITY then
    print("You are using the Pity shield.")
    thingToFire = MT_THROWNAUTOMATIC
elseif shield == SH_WHIRLWIND then
    print("You are using the Whirlwind shield.")
    thingToFire = MT_THROWNSCATTER
end
-- And so on...


More player_t attributes
A list of all player powers, as well as shield constants
 

Who is viewing this thread (Total: 0, Members: 0, Guests: 0)

Back
Top