Re: LunaLua - Lunadll with lua [Streaming Question Poll]
Posted: Tue Apr 07, 2015 12:59 pm
by Kevsoft
Sure, backwards compatbility will always be.
Re: LunaLua - Lunadll with lua [Streaming Question Poll]
Posted: Sat May 02, 2015 2:58 pm
by HenryRichard
Is there a way to trigger events when you collide with a block? I know there is if you use autocode, but I'd rather use Lua if it's possible.
EDIT: Also, is there any way to scale/transform images that are displayed? We could do a ton of cool things if that's possible...
Re: LunaLua - Lunadll with lua [Streaming Question Poll]
Posted: Sat May 02, 2015 4:39 pm
by Kevsoft
HenryRichard wrote:Is there a way to trigger events when you collide with a block? I know there is if you use autocode, but I'd rather use Lua if it's possible.
Yes there is. You can use the Block:collidesWith function + triggerEvent function. But I don't have a sample code at the moment.
HenryRichard wrote:EDIT: Also, is there any way to scale/transform images that are displayed? We could do a ton of cool things if that's possible...
not yet, but with the new opengl render coming, we will see what is possible
Re: LunaLua - Lunadll with lua [Streaming Question Poll]
Posted: Sat May 02, 2015 5:30 pm
by HenryRichard
Kevsoft wrote:
HenryRichard wrote:Is there a way to trigger events when you collide with a block? I know there is if you use autocode, but I'd rather use Lua if it's possible.
Yes there is. You can use the Block:collidesWith function + triggerEvent function. But I don't have a sample code at the moment.
That's good to know - to bad I can't figure out how to get it to work since I'm a complete l=Lua noob and all I know is based off of Java and C. If you do happen to make an example at some point, I'd like to see it.
Kevsoft wrote:
HenryRichard wrote:EDIT: Also, is there any way to scale/transform images that are displayed? We could do a ton of cool things if that's possible...
not yet, but with the new opengl render coming, we will see what is possible
Let's hope for the best - even if we can't scale or rotate, we're still gonna be able to do great things!
Also, I can't seem to get a line of text that displays your current star count. I tried to use this -
local a = 0
function onKeyDown(keycode)
if(keycode == KEY_DOWN) do
a = a + 1
end
end
Re: LunaLua - Lunadll with lua [Streaming Question Poll]
Posted: Fri May 15, 2015 6:22 pm
by Onule
I did that before, only adds 1 every time the key is pressed, I want to make it so that while I'm holding down the key, it would add 1, so I could use it like a timer.
Example would be this
I tried to mess with this, but couldn't get it to work.
also if do
Re: LunaLua - Lunadll with lua [Streaming Question Poll]
local isLayerShown = false
function onLoop()
if (player.x > -200000 and isLayerShown == false) then
triggerEvent("ShowLayer")
isLayerShown = true
else
if(isLayerShown == true)then
triggerEvent("HideLayer")
end
end
end
Re: LunaLua - Lunadll with lua [Streaming Question Poll]
Posted: Sun May 17, 2015 5:08 pm
by Onule
Wouldn't that cause the layer to show for just a frame?
Re: LunaLua - Lunadll with lua [Streaming Question Poll]
Posted: Mon May 18, 2015 12:43 am
by Kevsoft
Oh, yea, you right. You have to check also in the other direction.
local isLayerShown = false
function onLoop()
if (player.x > -200000 and isLayerShown == false) then
triggerEvent("ShowLayer")
isLayerShown = true
elseif(player.x <= -200000 and isLayerShown == true)then
triggerEvent("HideLayer")
isLayerShown = false
end
end
Re: LunaLua - Lunadll with lua [Streaming Question Poll]
function onLoop()
cannonBlocks = findblocks(34);
for k,v in pairs(cannonBlocks) do
if(v:collidesWith(player) == 1) then
cannon(player);
elseif(v:collidesWith(player2) == 1) then
cannon(player2);
end
end
end
function cannon(thePlayer)
thePlayer.x = thePlayer.x + 240;
thePlayer.y = thePlayer.y - 256;
thePlayer.speedX = 12;
thePlayer.speedY = -12;
thePlayer.HasJumped = -1;
thePlayer.FacingDirection = 1;
--playSFXSDL("SM64-cannonfire.wav");
end
The level loads fine, but the game freezes when I test, and I get a "SuperMarioBrosX.org has stopped working" window. Is this a problem with my installation or my code or my computer or something else?
What really frustrates me is that it was working just fine but then just stopped working...
EDIT: I just tried re-installing lunalua, and I think it was a bit outdated. However, it's still freezing.
Re: LunaLua - Lunadll with lua [Streaming Question Poll]
Posted: Wed May 20, 2015 4:04 am
by Kevsoft
Overall it looks fine to me. I will test it, when I am back home.
function onLoop()
cannonBlocks = findblocks(34);
for k,v in pairs(cannonBlocks) do
if(v:collidesWith(player) == 1) then
cannon(player);
if(player2) then
if(v:collidesWith(player2) == 1) then
cannon(player2);
end
end
end
end
Re: LunaLua - Lunadll with lua [Streaming Question Poll]
Posted: Wed May 20, 2015 1:21 pm
by HenryRichard
Thanks, it's working perfectly now!
I'll remember to check if player2 exists next time.