DSLua Community
Welcome, Guest. Please login or register.
May 18, 2012, 09:32:47 PM
1371 Posts in 262 Topics by 33109 Members
Latest Member: Limewire Download
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Need Help?  |  Help how do i load my own Sprites Images and backgrounds using DSLua 0.5?? « previous next »
Pages: [1]
Author Topic: Help how do i load my own Sprites Images and backgrounds using DSLua 0.5??  (Read 1842 times)
jester
Waxing Crescent
**
Posts: 86


Jester Corp DS Logo


WWW
« on: September 04, 2006, 07:17:23 AM »

Help how do i load my own Sprites and Images using DSLua 0.5??
Logged

CURRENT PROJECT:

JesterCorp DS- 2D FIGHTING GAME!!! Due out August 19th 2007!!!Having Sprite Issues but Toast is helping me ALOT
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #1 on: September 04, 2006, 12:23:42 PM »

If you are doing sprites, save them as 256 color bitmaps. Sprites must be 16 by 16, 32 by 32, 64 by 64, or any combination of the three. After you are done, put the image in the bin folder. Then use DOS. Use the cd command to get yourself to the bin directory. Then type:

Code:
gfx2gba -pPalettename.pal -t8 Yourbitmap.bmp

Where Palettename.pal is what you want to call your .pal file, and Yourbitmap.bmp is what the bitmap is called. It should output a palette (.pal) file, and a raw (.raw) file. Now put both of those into the scripts folder. Then, make a .lua file in the scripts folder. Edit it with Notepad or something... here is code to show a simple 32*32 sprite:

Code:
SCREEN_BOTTOM = 0
SCREEN_TOP = 1
YourImagePal = 0
Sprite.LoadPalette( SCREEN_BOTTOM, YourImagePal, "SomePalette.pal" )
FRAMESTRIP = FrameStrip.Create( SCREEN_BOTTOM, 32, 32, "256" )
FRAMESTRIP:LoadBin( "SomeRawFile.raw", 1 )
YourSprite = Sprite.Create( FRAMESTRIP, 0, YourImagePal, 32, 0 )

And for maps, it can be any height/width, but it must be:

1. AT LEAST 256 X * 192 Y

2. Height and Width must be a multiple of 8

That's it. Then, save it as a 256 color bitmap and put it in the bin folder. Now use the cd command again to get to the bin folder and type:

Code:
gfx2gba -pAnotherPalette.pal -m -t8 MyMapBitmap.bmp

Where AnotherPalette.pal is the palette file it will take, and MyMapBitmap.bmp is the bitmap file for the map. The -m command made it output a .map file, as well. Now put the .pal, .raw, and .map files into the scripts folder. Make another script. Here is an example of creating a 512 * 512 map on the bottom screen:

Code:
SCREEN_BOTTOM = 0
SCREEN_TOP = 1
MyBottomMap = Screen.LoadTileBG()
MyBottomMap:LoadPalette( "MyMapPalette.pal" )
MyBottomMap:LoadTiles( "MyMapRaw.raw", 256 )
MyBottomMap:LoadMap( "MyMapMapFile.map", ( 512 / 8 ), ( 512 / 8 ) )
Screen.Initialize( SCREEN_BOTTOM, MyBottomMap )

And if your map is bigger than 256 by 192, you can scroll it by typing:

Code:
MyBottomMap:ScrollXY( NewX, NewY )

Enjoy DSLua!
Logged

Code:
-- Bored? Read code line below.
-- Bored? Read code line above.



^^ That works, I SWEAR! ^^
jester
Waxing Crescent
**
Posts: 86


Jester Corp DS Logo


WWW
« Reply #2 on: September 04, 2006, 01:37:07 PM »

thanks alot  Grin what about loading sounds and stuff?
Logged

CURRENT PROJECT:

JesterCorp DS- 2D FIGHTING GAME!!! Due out August 19th 2007!!!Having Sprite Issues but Toast is helping me ALOT
CPU_Smarts
Waxing Crescent
**
Posts: 15


« Reply #3 on: September 04, 2006, 01:43:05 PM »

I was wondering, how can you go from on background to another? such as touching the screen and it goes to the main menu ect?
Logged
Jeremysr
First Quarter
***
Posts: 215



WWW
« Reply #4 on: September 04, 2006, 03:46:09 PM »

jester: Try this -> http://www.bio-gaming.com/jeremy/dslua/index.php?act=soundandmusic
Logged
jester
Waxing Crescent
**
Posts: 86


Jester Corp DS Logo


WWW
« Reply #5 on: September 05, 2006, 04:15:35 AM »

code someone check this code and give me feedback if it is correct for loading text on the top screen and then a background:



SCREEN_TOP = 1
BGTopText = Screen.LoadTextBG()
Screen.Initialize( SCREEN_TOP, BGTopText )

BGTopText:PrintXY( 10, 12, "JesterCorp DS!" )
SCREEN_BOTTOM = 0
SCREEN_TOP = 1
MyBottomMap = Screen.LoadTileBG()
MyBottomMap:LoadPalette( "ghetto.pal" )
MyBottomMap:LoadTiles( "ghetto.raw", 256 )
MyBottomMap:LoadMap( "ghetto.map", ( 256 / 8 ), ( 192 / 8 ) )
Screen.Initialize( SCREEN_BOTTOM, MyBottomMap )


DSLua.WaitForAnyKey()
Logged

CURRENT PROJECT:

JesterCorp DS- 2D FIGHTING GAME!!! Due out August 19th 2007!!!Having Sprite Issues but Toast is helping me ALOT
Pages: [1]
« previous next »
    Jump to: