SMBX thinks your hammer brother has 3 frames for each direction, and doesn't load any beyond that, because they "don't exist".
My way to circumvent this redigit-like programming like this is to completely disable the frame counter and add in my own. In your case, I'd write frames=18 into the .txt and just add if calls asking for direction, ai5, your own frame counter, and the times when he should use his 3rd frame.
Enjl wrote:SMBX thinks your hammer brother has 3 frames for each direction, and doesn't load any beyond that, because they "don't exist".
My way to circumvent this redigit-like programming like this is to completely disable the frame counter and add in my own. In your case, I'd write frames=18 into the .txt and just add if calls asking for direction, ai5, your own frame counter, and the times when he should use his 3rd frame.
Well, I got it working. It feels a bit clunky, but they render correctly - I still have to work on the death effect, but the NPC works great.
local npcconfig = loadAPI("npcconfig");
npcconfig[29].frames = 6 * 3;
npcconfig[29].framestyle = 0;
local hammerBroFrameTimer = 0;
local broIds = {89, 210};
function onLoop()
for k, v in pairs(NPC.get(29, -1)) do
if(v.friendly) then v.friendly = false; end
if(v.msg.str ~= "") then
if(v.msg.str == "goomba") then
v.ai4 = 1;
elseif(v.msg.str == "rinka") then
v.ai4 = 2;
end
v.msg = "";
end
v.animationTimer = 0;
if(v.ai5 > 0) then v.ai5 = v.ai5 - 1; end
local frameAdd = 0;
if(v.ai5 > 0) then frameAdd = 2; else frameAdd = math.floor(hammerBroFrameTimer / 16); end
if(v.direction == DIR_RIGHT) then frameAdd = frameAdd + 3; end
v.animationFrame = (v.ai4 * 6) + frameAdd;
for k1,v1 in pairs(NPC.getIntersecting(v.x, v.y, v.x + v.width, v.y + v.height)) do
if(v1.id == 30 and v1.ai1 == 0) then
v.ai5 = 16;
if(v.ai4 == 0) then
v1.ai1 = 1;
else
v1.id = broIds[v.ai4];
end
end
end
end
hammerBroFrameTimer = (hammerBroFrameTimer + 1) % 32;
end
Maybe when drawImageToScene gets priorities within SMBX-drawn things I'll make a better version, but this'll do for now.
Cool about the birdo egg it's working to kill Npcs now Nice
Also I need to found how to make ill use now the Larry Ring but how I can
make it's ring moving in any direction I want like he do any idea ? (the id is 269)
(not just right and left, in diagonal also)
lotus006 wrote:Cool about the birdo egg it's working to kill Npcs now Nice
Also I need to found how to make ill use now the Larry Ring but how I can
make it's ring moving in any direction I want like he do any idea ? (the id is 269)
(not just right and left, in diagonal also)
Easy, set its x and y speeds.
However, if you want to be able to place it in the level, I would suggest using a system like Henry Richard's, using the NPC's message to determine the direction.
lotus006 wrote:Cool about the birdo egg it's working to kill Npcs now Nice
Also I need to found how to make ill use now the Larry Ring but how I can
make it's ring moving in any direction I want like he do any idea ? (the id is 269)
(not just right and left, in diagonal also)
Easy, set its x and y speeds.
However, if you want to be able to place it in the level, I would suggest using a system like Henry Richard's, using the NPC's message to determine the direction.
One thing to note is that if you want to make it move diagonally at the same speed it moves horizontally/vertically, you'll probably want to use some basic trigonometry. This works okay:
...where angle is the angle (big surprise), length is the speed it moves, and v is the NPC.
EDIT: What's the best way to add animation frames to the player? I could use Graphics.drawImageToScene, but that makes the player render in front of everything, which is bad.
lotus006 wrote:Cool about the birdo egg it's working to kill Npcs now Nice
Also I need to found how to make ill use now the Larry Ring but how I can
make it's ring moving in any direction I want like he do any idea ? (the id is 269)
(not just right and left, in diagonal also)
Easy, set its x and y speeds.
However, if you want to be able to place it in the level, I would suggest using a system like Henry Richard's, using the NPC's message to determine the direction.
One thing to note is that if you want to make it move diagonally at the same speed it moves horizontally/vertically, you'll probably want to use some basic trigonometry. This works okay:
...where angle is the angle (big surprise), length is the speed it moves, and v is the NPC.
EDIT: What's the best way to add animation frames to the player? I could use Graphics.drawImageToScene, but that makes the player render in front of everything, which is bad.
Thanks for both, I will check soon sorry for the late reply
LOL thnx again guys @HenryRichard & @ TheSaturnyoshi for the help !
Now I have my Spread S powerups in SMBX !!! haha , I love to much LunaLua !!
But when to much bullets the game slow too much, I think is because about colliders api on my bullets
need to find a way without this !
HenryRichard wrote:I found a bug: If you replace an effect with a .png, it doesn't automatically resize.
That happens with some backgrounds too, especially when they are larger than original. I remember that placing a mask gif file of correct size should work as a temporary fix. It will tell the size of the sprite to the editor, but also be overridden by the png's graphics.
Willhart wrote:That happens with some backgrounds too, especially when they are larger than original. I remember that placing a mask gif file of correct size should work as a temporary fix. It will tell the size of the sprite to the editor, but also be overridden by the png's graphics.
I guess I could do that if I had to.
I'm still wondering about adding more frames to a character - It'd be weird if my Kirby playable didn't open his mouth when he inhaled.
So, I'm having an issue.
Always when I install LunaLua, I can run it normally, but only one single time. After that, if I try to run it, I always get this error:
"Instruction at 0x7295efa8 referenced memory at 0x514100dd. The memory could not be read."
I know it may be due to my PC being old, but I just wanna know why.
Welp, kind of stuck writing a lua code. I tried to but ofcourse i failed. So i wanted to ask here;
"Is there by any chance a way to let rinka or volcano lotus spawn their fireballs in circles? Just wondering..."
function onLoop()
-- set up for section 4
NPCs = NPC.get({--[[table of npcs you want to wrap]]}, 3)
for i=1,table.getn(bobombx) do
if (bobombx[i].y >= -140000) then
bobombx[i].y = -140632
end
end
if (player.section == 3 and player.y > -139950) then
player.y = -140666
end
if(player2) then
if (player2.section == 3 and player2.y > -139950) then
player2.y = -140666
end
end
end
function onLoop()
local sectBottom = player.sectionObj.boundary.bottom
local sectTop = player.sectionObj.boundary.top
if (player.speedY > 0) then
if (player.y > sectBottom) then
--bottom to top
player.y = sectTop - 48
end
elseif (player.speedY < 0) then
if (player.y < sectTop - 48) then
--top to bottom
player.y = sectBottom
end
end
end