Re: Need help with lua? - LunaLua General Help
Posted: Wed Jan 17, 2018 9:02 pm
Can you force something inanimate to become animated? For example, can I force a dummy sprite to become animated on the world map using lua?
Forums for SMBX
https://www.smbxgame.com/forums/
You can find 0x114 on this sheet which determines the sprite index of the player on his sheet:Notxarb wrote:Taycamgame wrote:Can we add new animations to the character spritesheets and access them for new animations? If so, what are the dimensions of at least mario's animations? Can we resize the spritesheet and have it still work?
If we can, can we add new spritesheets to the player folder for new powerups, if so, is there a limit to how many spritesheets we have?
Not strictly speaking true. 50 does have a counterpart but it is guaranteed to be invisible, since it's not on the sheet.Enjl wrote: both 0 and 50 can be used for direction-independent frames, as they have no counterpart
Sorry, what is that sprite sheet supposed to be used for? Can't you just slap any graphic anywhere on it?Enjl wrote:You can find 0x114 on this sheet which determines the sprite index of the player on his sheet:Notxarb wrote:Taycamgame wrote:Can we add new animations to the character spritesheets and access them for new animations? If so, what are the dimensions of at least mario's animations? Can we resize the spritesheet and have it still work?
If we can, can we add new spritesheets to the player folder for new powerups, if so, is there a limit to how many spritesheets we have?
https://wohlsoft.ru/pgewiki/SMBX_Player_Offsets
It links to this spritesheet which shows the boxes and ids of every frame on the sheet. Frames are direction-dependent, though both 0 and 50 can be used for direction-independent frames, as they have no counterpart:
[rimg]http://i.imgur.com/1dnW3g3.png[/rimg]
It's not currently possible to resize this sheet, and there is a lot more going into making new powerups than providing a spritesheet for them (player.powerup, mapping npcs to grant powerup effects, perhaps adding more 0x122 powerup animations or finding an external way to do the same)
It shows you where on the player sprite sheets each frame index looks at.Taycamgame wrote: Sorry, what is that sprite sheet supposed to be used for? Can't you just slap any graphic anywhere on it?
There's no duplicate onStart or onTickEnd, I'm testing with only one player, and the blocks are still acting like "?" blocks, even though they're in the shatterableBlocks table. So the only reason seems to be that it isn't running the code while testing. But even then, it's called luna.lua and it's in the same folder as the custom graphics, so I have no idea why it's not working apart from not being implemented into the tester, which I'm pretty sure it should be.Quantumenace wrote:The shatterableBlocks table needs to have a list of the block types you're using for this. Otherwise I don't know why it wouldn't be working unless the file isn't being run or you have duplicate onStart or onTickEnd or something. Are the blocks with contents still acting like "?" blocks?
Edit: It spawns the NPC in the same section as player 1, which might cause issues in 2-player. It takes a little work to determine which section a block is actually in.
The file needs to be named lunadll.lua (or lunaworld.lua for episode-wide level code) in Beta 3 and earlier.The Dwarven Digger wrote:There's no duplicate onStart or onTickEnd, I'm testing with only one player, and the blocks are still acting like "?" blocks, even though they're in the shatterableBlocks table. So the only reason seems to be that it isn't running the code while testing. But even then, it's called luna.lua and it's in the same folder as the custom graphics, so I have no idea why it's not working apart from not being implemented into the tester, which I'm pretty sure it should be.Quantumenace wrote:The shatterableBlocks table needs to have a list of the block types you're using for this. Otherwise I don't know why it wouldn't be working unless the file isn't being run or you have duplicate onStart or onTickEnd or something. Are the blocks with contents still acting like "?" blocks?
Edit: It spawns the NPC in the same section as player 1, which might cause issues in 2-player. It takes a little work to determine which section a block is actually in.
this is, as I understand it, pretty difficult to implementNotxarb wrote:a feature to speed/slow music?
It requires a complete overhaul of the audio system, possibly away from SDL.The0x539 wrote:this is, as I understand it, pretty difficult to implementNotxarb wrote:a feature to speed/slow music?
What do you mean by that? Would I have to include a separate graphic and draw it repeatedly?PixelPest wrote:You would probably have to redraw the sprite.
Since we're talking world map here in particular... that's tougher than doing it for levels.Notxarb wrote:Can you force something inanimate to become animated? For example, can I force a dummy sprite to become animated on the world map using lua?
We need to be able to use .txt files to edit block and BGO graphics in the same way we can with NPCs.Enjl wrote:Since we're talking world map here in particular... that's tougher than doing it for levels.Notxarb wrote:Can you force something inanimate to become animated? For example, can I force a dummy sprite to become animated on the world map using lua?
For levels, you can use Graphics.drawImageToSceneWP to draw your custom sprite in the same location as the SMBX-drawn inanimate objects, at the priority at which you want it.
https://wohlsoft.ru/pgewiki/LunaLua_glo ... _functions
For the world map, you cooould do this too, but we don't have a priority system in place for the map currently, so it would render above everything, even the HUD.
For Level Contest Japan, I've made a hack that lets me sorta circumvent that:
https://www.youtube.com/watch?v=GaJAMsfKc2o
There are many sprites here drawn with Graphics.drawImageToSceneWP, but you'll notice that nothing draws over the HUD and pause menu. This is because I manually redraw those at a higher priority. The custom sprites would still overlap with the player, but I've tried my best to avoid this from being noticeable on this overworld.
So... for levels, rather simple. For the map, a massive hack.
This will be possible for BGOs in Beta 4, but not Blocks just yet.The Dwarven Digger wrote: We need to be able to use .txt files to edit block and BGO graphics in the same way we can with NPCs.
In all fairness you can already resize blocks by just... making their sprites bigger. Animations and block types would be neat, but yeah. Currently impossible. Size is already a great help in many cases, at least!Hoeloe wrote:This will be possible for BGOs in Beta 4, but not Blocks just yet.The Dwarven Digger wrote: We need to be able to use .txt files to edit block and BGO graphics in the same way we can with NPCs.
https://wohlsoft.ru/pgewiki/Data_(class)Notxarb wrote:Do global variables save to the save file automatically? If not, how can we save variables to the save file?