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?
Okay, using that code, it's not returning an error!
But the sound effect still won't play. It's an .ogg file, so I'm not entirely sure why it won't play.
Aperrentis wrote:Okay, using that code, it's not returning an error!
But the sound effect still won't play. It's an .ogg file, so I'm not entirely sure why it won't play.
Is it in the level's folder? If so, is it resampled to 44100 Hz (I think that's what it needs to be)?
Is there a way to change the maximum run speeds of characters? I didn't see how to on the PGE wiki, but it seems like it should be possible seeing as it's different for some characters. These are the values I got by reading speedX:
There are a lot of diffrent values. I do know where they are but I am not sure what they refere to. At the moment there is no way to change the maximum speed of the characters.
Turns out the issue is with the current version of lunalua.
If the symptom you're seeing is that OnEvent only gets called once per tick, that's a known issue as of the last LunaDLL release, and a fix is already in place for the next release
Using onEventDirect worked, but hopefully if the next release is within a few days, will change it back to onEvent.
I made an account just to post this question because I don't really know where else to go for help :/ I've fiddled with trying to get the test code you provide in LunaLua on the first page to work in a custom level so I can start using it to start changing jump mechanics (double jump and the like) for hours, but nothing seems to work. I've scoured the Internet and help topics on this trying different things, but nothing seems to get it to work. So, I downloaded everything via the link you provided and when I start the game it has the whole LunaLua v0.6.1.1 Beta thing on it, so I know that part is fine. The part that I think I'm stumbling on is the whole .lua thing you make in the folder with your level. I have a folder for my level (which right now is just a flat line of blocks, Mario, and a background just to test it) and I downloaded notepad++ since I heard that was easier to code with. I created a .lua file with it and copy-pasted the code you provided and even tried some other test code out, but when I tested my level out no text shows up and no changes occur to the level. I've never coded before in my life and I have no idea if there's just something I'm completely missing here or not. I can give you screenshots if you need them to figure out what's wrong, any help would be greatly appreciated. I've never really made a SMBX level before, but have wanted to for a long time and a contest from this group I'm a part of is getting me to jump into it.
Ah, welcome!
When SMBX with LunaLua runs, then you're already on the good rail.
You lua file must be called "lunadll.lua" and has to be in the custom folder of your level file.
Here the directory hierarchy:
Holy crap, it worked! Thanks a ton! I never would have thought all I needed to do was create another folder next to my level and THEN put the .lua in it. Time to experiment! I'll be sure to come back if I have any more questions!
Ok, so I've been trying to mess around with Mario's jumping and I'm struggling a bit, mainly due to a lack of knowledge of commands and what not. I want to give Mario another jump when he releases a grabbed object. I found a video where someone is able to give Mario a double jump and I've been messing with the commands that person had in hopes of at least accomplishing the grab release jump, but I haven't had much luck. I feel bad just asking others for so much help on this, but I'm just really stuck right now. Also, how do you make specific NPC's grabbable? I feel kind of dumb for asking that, but I honestly don't know how to do that. Also, sorry if this isn't the proper place to ask this! I can delete this if needed. Here's the video I've used for reference code when trying to give Mario that jump:
canJump = false --holds if mario can double jump. Avoids an "ahippinandahoppin"-like behavior.
hasHoldingJumpingItem = false
function onJump()
if(player.holdingNPC)then
canJump = true
hasHoldingJumpingItem = true
end
end
function onKeyDown(keycode)
if (keycode == KEY_JUMP) then --if the player hits JUMP while
if (canJump and hasHoldingJumpingItem and not player.holdingNPC) then --double jump is allowed
player.speedY = -10 --make him jump.
playSFX(1) --play jump sound effect.
canJump = false --now Mario can't jump
hasHoldingJumpingItem = false
end
end
end
function onJumpEnd() --if you step in the ground
canJump = false --obviously you can't double jump directly from the ground.
hasHoldingJumpingItem = false
end
Awhile back I asked something similar to this, but is there a way to have two "Links" but they look different. That is, by using Luna.lua. I'll try to put it into more detail, so here I go...
So let's say that I have Link. I want him in my game, however, I want to add another character that uses Link's sprite sheet. However, I want to switch between them whenever I want. I know that you can only use one Link sheet at a time in regular smbx. Can I somehow change that in Luna.lua? If I could, that would be great! If I can't then I may be in sort of a jam... Thanks in advance.
Last edited by Nicholas-Link on Sat Jun 06, 2015 4:24 pm, edited 1 time in total.
Will it ever be possible to change how fast the player falls in water, when they're not swimming? I think in SMBX it is harder to go down than up when swimming.
FanofSMBX wrote:Will it ever be possible to change how fast the player falls in water, when they're not swimming? I think in SMBX it is harder to go down than up when swimming.
Maybe in the future. Generally all the speed fields has not been revealed yet.
Okay, so LunaLua v0.7 is finally out.
Coming with a whole bunch of changes:
* First of all a huge thank to Rednaxela for the OpenGL renderer! This should improve the overall speed of SMBX.
* Added Layer functions :show :hide :toggle
* Added new Event onInputUpdate + player control fields (in player class)
* Added new Event onLevelExit
* Added new Warp class
* Added new BGO class
* A lot of functions has been moved to namespaces. This doesn't mean that the old functions don't work anymore. It just recommended to use the new ones, as they have been improved.
* Some minior performance improvement and bug fixes in SMBX.