This is the place for discussion and support for LunaLua and related modifications and libraries.
Moderator: Userbase Moderators
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?
|
|
|
|
-
lotus006
- Spike

- Posts: 284
- Joined: Thu Sep 24, 2015 12:59 am
Postby lotus006 » Wed Dec 09, 2015 1:12 am
Hi, I have a question about "Graphics.drawImage" I try to re-create chest from toad house but when I place with this
the player is walking behind the graphic, is there a way to make the player walk in front of the graphic ?
P.S. :
I'm surprised there is no one have done the Whistler in the 2.0 hehe  , this one should be easy to do now with Lua 
|
|
|
|
|
|
|
|
|
-
Kevsoft
- Ripper II

- Posts: 375
- Joined: Sun Jul 27, 2014 8:03 am
Postby Kevsoft » Wed Dec 09, 2015 4:04 am
lotus006 wrote:is there a way to make the player walk in front of the graphic ?
Render priority currently only applies to custom lua sprites. But it is planned to also apply it to internal rendering.
|
|
|
|
|
|
|
|
|
-
lotus006
- Spike

- Posts: 284
- Joined: Thu Sep 24, 2015 12:59 am
Postby lotus006 » Wed Dec 09, 2015 4:50 am
Kevsoft wrote:lotus006 wrote:is there a way to make the player walk in front of the graphic ?
Render priority currently only applies to custom lua sprites. But it is planned to also apply it to internal rendering.
Thanks For the info, for now i'll will use the same chest npc as (A SMB3 Thing)
Also how to make an npc hurting npc ? I'll try to make bullet to go in a right line but I use birdo's eggs but it wont kill npc just
players.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9865
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Wed Dec 09, 2015 4:53 am
lotus006 wrote:Kevsoft wrote:lotus006 wrote:is there a way to make the player walk in front of the graphic ?
Render priority currently only applies to custom lua sprites. But it is planned to also apply it to internal rendering.
Thanks For the info, for now i'll will use the same chest npc as (A SMB3 Thing)
Also how to make an npc hurting npc ? I'll try to make bullet to go in a right line but I use birdo's eggs but it wont kill npc just
players.
Code: Select all tableOfBirdoEggs = NPC.get(40, -1) -- I think 40 was the birdo egg
for _, v in pairs (tableOfBirdoEggs) do
tableOfDeath = NPC.getIntersecting(v.x, v.y, v.x + v.width, v.y + v.height)
for k, w in pairs (tableOfDeath) do
if not w.id == --[[use this line to add exceptions to the npc ids you want to kill]] then
w:kill()
end
end
end
|
|
|
|
|
|
|
|
|
-
lotus006
- Spike

- Posts: 284
- Joined: Thu Sep 24, 2015 12:59 am
Postby lotus006 » Wed Dec 09, 2015 5:05 am
Code: Select all tableOfBirdoEggs = NPC.get(40, -1) -- I think 40 was the birdo egg
for _, v in pairs (tableOfBirdoEggs) do
tableOfDeath = NPC.getIntersecting(v.x, v.y, v.x + v.width, v.y + v.height)
for k, w in pairs (tableOfDeath) do
if not w.id == --[[use this line to add exceptions to the npc ids you want to kill]] then
w:kill()
end
end
end
yup 40 is the id for the eggs , but with your code a green koopas wont die or just green shell also 
but the exception to not kill the npc I want, work but only for the eggs weird,
maybe the eggs can only kill the players.
I have a plan also maybe with trying colliders lua stuff, when the colliders of the eggs touch a npc is dying !
but not sure with colliders
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9865
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Wed Dec 09, 2015 5:11 am
lotus006 wrote:
Code: Select all tableOfBirdoEggs = NPC.get(40, -1) -- I think 40 was the birdo egg
for _, v in pairs (tableOfBirdoEggs) do
tableOfDeath = NPC.getIntersecting(v.x, v.y, v.x + v.width, v.y + v.height)
for k, w in pairs (tableOfDeath) do
if not w.id == --[[use this line to add exceptions to the npc ids you want to kill]] then
w:kill()
end
end
end
yup 40 is the id for the eggs , but with your code a green koopas wont die or just green shell also 
but the exception to not kill the npc I want, work but only for the eggs weird,
maybe the eggs can only kill the players.
I have a plan also maybe with trying colliders lua stuff, when the colliders of the eggs touch a npc is dying !
but not sure with colliders
If you want to test it with any npc, remove the if clause.
|
|
|
|
|
|
|
|
|
-
lotus006
- Spike

- Posts: 284
- Joined: Thu Sep 24, 2015 12:59 am
Postby lotus006 » Wed Dec 09, 2015 5:13 am
Enjl wrote:lotus006 wrote:
Code: Select all tableOfBirdoEggs = NPC.get(40, -1) -- I think 40 was the birdo egg
for _, v in pairs (tableOfBirdoEggs) do
tableOfDeath = NPC.getIntersecting(v.x, v.y, v.x + v.width, v.y + v.height)
for k, w in pairs (tableOfDeath) do
if not w.id == --[[use this line to add exceptions to the npc ids you want to kill]] then
w:kill()
end
end
end
yup 40 is the id for the eggs , but with your code a green koopas wont die or just green shell also 
but the exception to not kill the npc I want, work but only for the eggs weird,
maybe the eggs can only kill the players.
I have a plan also maybe with trying colliders lua stuff, when the colliders of the eggs touch a npc is dying !
but not sure with colliders
If you want to test it with any npc, remove the if clause.
it work but only the eggs is killed then it cannot reach else where
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9865
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Wed Dec 09, 2015 5:20 am
lotus006 wrote:Enjl wrote:
Code: Select all tableOfBirdoEggs = NPC.get(40, -1) -- I think 40 was the birdo egg
for _, v in pairs (tableOfBirdoEggs) do
tableOfDeath = NPC.getIntersecting(v.x, v.y, v.x + v.width, v.y + v.height)
for k, w in pairs (tableOfDeath) do
if not w.id == --[[use this line to add exceptions to the npc ids you want to kill]] then
w:kill()
end
end
end
yup 40 is the id for the eggs , but with your code a green koopas wont die or just green shell also 
but the exception to not kill the npc I want, work but only for the eggs weird,
maybe the eggs can only kill the players.
I have a plan also maybe with trying colliders lua stuff, when the colliders of the eggs touch a npc is dying !
but not sure with colliders
If you want to test it with any npc, remove the if clause.[/quote]
it work but only the eggs is killed then it cannot reach else where[/quote]
OH! Duh, silly me. Add this around w:kill():
if not w.id == 40 then
end
|
|
|
|
|
|
|
|
|
-
Bibifoc
- Koopa

- Posts: 17
- Joined: Tue Dec 01, 2015 3:05 pm
Postby Bibifoc » Wed Dec 09, 2015 4:20 pm
Hello !
So I implemented the lua code of the double jump made by tb1024 ( http://engine.wohlnet.ru/forum/viewtopic.php?f=26&t=338 ) in SMBX.
First It was satisfying to see Mario do a double jump, then I saw this double jump was not perfect since you couldn't do a drop jump (I mean : running toward a pit without jumping, falling and then do the jump in the air).
I tried to correct that, it worked, but then there was a problem with vertically moving layers and NPCs which wouldn't allow this drop jump (because I made a condition based on the Y speed of the player). At this point I was blocked, trying random stuff, and I finally decided to delete all the mess I did in the code and go on this topic to ask for help. 
How are you supposed to make a double jump with the drop jump ? 
|
|
|
|
|
|
|
|
|
-
HenryRichard
- Reznor

- Posts: 2843
- Joined: Mon Dec 23, 2013 12:09 pm
- Flair: Is this where I type my password?
-
Contact:
Postby HenryRichard » Wed Dec 09, 2015 4:49 pm
Still can't figure this out.
HenryRichard wrote:So I'm trying to make this really cool x Bro api where you can have multiple different kinds of bros in a level (hammer bros, goomba bros, and rinka bros in this code). The functionality is there (type what you want them to throw in the message box, disable friendly, and they throw it), but I'd like to give them all different graphics (because I have a feeling that some people will be annoyed when enemies that look the same throw different things). I've tried setting v.animationFrame, but that's not working the way I want. Here's my code:
Code: Select all function onLoop()
for k, v in pairs(NPC.get(29, -1)) do
if(not v.friendly) then
if(v.msg.str ~= "") then
if(v.msg.str == "goomba") then
v.ai4 = 1;
v.ai5 = 89;
elseif(v.msg.str == "rinka") then
v.ai4 = 2;
v.ai5 = 210;
end
v.msg = "";
end
v.animationFrame = v.animationFrame + 6 * v.ai4;
for k,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
if(v.ai4 == 0) then
v1.ai1 = 1;
else
v1.id = v.ai5;
end
end
end
end
end
end
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9865
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Wed Dec 09, 2015 4:53 pm
HenryRichard wrote:Still can't figure this out.
HenryRichard wrote:So I'm trying to make this really cool x Bro api where you can have multiple different kinds of bros in a level (hammer bros, goomba bros, and rinka bros in this code). The functionality is there (type what you want them to throw in the message box, disable friendly, and they throw it), but I'd like to give them all different graphics (because I have a feeling that some people will be annoyed when enemies that look the same throw different things). I've tried setting v.animationFrame, but that's not working the way I want. Here's my code:
Code: Select all function onLoop()
for k, v in pairs(NPC.get(29, -1)) do
if(not v.friendly) then
if(v.msg.str ~= "") then
if(v.msg.str == "goomba") then
v.ai4 = 1;
v.ai5 = 89;
elseif(v.msg.str == "rinka") then
v.ai4 = 2;
v.ai5 = 210;
end
v.msg = "";
end
v.animationFrame = v.animationFrame + 6 * v.ai4;
for k,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
if(v.ai4 == 0) then
v1.ai1 = 1;
else
v1.id = v.ai5;
end
end
end
end
end
end
Can't you directly change the ID depending on the msg string, rather than fiddling about a lot with unused AI offsets?
|
|
|
|
|
|
|
|
|
-
HenryRichard
- Reznor

- Posts: 2843
- Joined: Mon Dec 23, 2013 12:09 pm
- Flair: Is this where I type my password?
-
Contact:
Postby HenryRichard » Wed Dec 09, 2015 5:02 pm
I could, but then a ! would show up when you're near the bro.
Also, is there something wrong with messing with unused AI slots? I don't want to break the game or anything, so I could try to find a workaround if that would happen.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9865
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Wed Dec 09, 2015 5:43 pm
There's nothing wrong with it, it just seems like an overly complex way to handle it. Also, wouldn't the "!" appear near the NPC either way?
|
|
|
|
|
|
|
|
|
-
HenryRichard
- Reznor

- Posts: 2843
- Joined: Mon Dec 23, 2013 12:09 pm
- Flair: Is this where I type my password?
-
Contact:
Postby HenryRichard » Wed Dec 09, 2015 5:44 pm
Enjl wrote:There's nothing wrong with it, it just seems like an overly complex way to handle it. Also, wouldn't the "!" appear near the NPC either way?
No, as I'm removing the message.
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9865
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Wed Dec 09, 2015 5:55 pm
Oh, I must've overlooked that line.
Looking over the code a second time, I can't see anything which would cause any issues. I don't know if I'm spouting some nonsense right here, but maybe it's because the key for the hammers is "k", which is also the key for the hammer brothers? Try changing one of the "k"s to "k1" or something.
|
|
|
|
|
|
|
|
|
-
HenryRichard
- Reznor

- Posts: 2843
- Joined: Mon Dec 23, 2013 12:09 pm
- Flair: Is this where I type my password?
-
Contact:
Postby HenryRichard » Wed Dec 09, 2015 6:00 pm
Enjl wrote:Oh, I must've overlooked that line.
Looking over the code a second time, I can't see anything which would cause any issues. I don't know if I'm spouting some nonsense right here, but maybe it's because the key for the hammers is "k", which is also the key for the hammer brothers? Try changing one of the "k"s to "k1" or something.
Did that, but they're still not changing their graphics right. What's supposed to happen is, based on the value of ai4, the graphics change. 0 is default, 1 is brown (goomba), and 2 is yellow-orange (rinka).
Here's my graphic file, in case you need to see it:
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9865
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Wed Dec 09, 2015 6:06 pm
OH I thought you were having trouble changing the npc ID. DERP, sorry. I don't know how I missed that. >.<
What exactly IS it doing that you're displeased with? It looks like it should work just fine.
|
|
|
|
|
|
|
|
|
-
HenryRichard
- Reznor

- Posts: 2843
- Joined: Mon Dec 23, 2013 12:09 pm
- Flair: Is this where I type my password?
-
Contact:
Postby HenryRichard » Wed Dec 09, 2015 6:09 pm
Enjl wrote:OH I thought you were having trouble changing the npc ID. DERP, sorry. I don't know how I missed that. >.<
What exactly IS it doing that you're displeased with? It looks like it should work just fine.
It's fine, I've made much bigger mistakes.
This is the problem. A rinka bro (which works perfectly fine) looks like this:
|
|
|
|
|
|
|
|
|
-
Emral
- Cute Yoshi Egg

- Posts: 9865
- Joined: Mon Jan 20, 2014 12:58 pm
- Flair: Phoenix
Postby Emral » Wed Dec 09, 2015 6:16 pm
My best guess is that the Hammer Bro AI overrides your changes made to animationTimer. I kind of expected a rainbow flashing hammer brother, since he doesn't change his animationFrame every frame normally, but you're setting him to do so.
You could override the hammer bro animation with your own completely, but that seems kind of last-resort-ish.
E: I think I figured it out:
SMBX thinks your hammer brother has 3 frames for each direction, and doesn't load any beyond that, because they "don't exist".
Last edited by Emral on Wed Dec 09, 2015 6:21 pm, edited 1 time in total.
|
|
|
|
|
|
|
|
|
-
HenryRichard
- Reznor

- Posts: 2843
- Joined: Mon Dec 23, 2013 12:09 pm
- Flair: Is this where I type my password?
-
Contact:
Postby HenryRichard » Wed Dec 09, 2015 6:21 pm
Enjl wrote:My best guess is that the Hammer Bro AI overrides your changes made to animationTimer. I kind of expected a rainbow flashing hammer brother, since he doesn't change his animationFrame every frame normally, but you're setting him to do so.
You could override the hammer bro animation with your own completely, but that seems kind of last-resort-ish.
It seems I can't even set the Hammer Bro's animation at all; I'm trying to force it to be 8 and it's not working.
Code: Select all v.animationTimer = 2;
v.animationFrame = 8;
...any ideas?
|
|
|
|
|
Return to “LunaLua”
Users browsing this forum: No registered users and 4 guests
|