DSLua Community
Welcome, Guest. Please login or register.
May 18, 2012, 09:22:36 PM
1371 Posts in 262 Topics by 33109 Members
Latest Member: Limewire Download
DSLua Community  |  DSLua - Best scripting language for Nintendo DS  |  Need Help?  |  please help me? (again) « previous next »
Pages: [1]
Author Topic: please help me? (again)  (Read 1592 times)
LeightonW87
Waxing Crescent
**
Posts: 17


« on: July 21, 2006, 12:48:10 PM »

Ok, I'm trying to do a scrolling Tile map but the problem I'm having is the emulator quits and I'm guessing I'm doing something bad Wink, oh well.

Could someone have a quick look at the script.
Code:
-- THIS DEFINES THE NAMES OF ARRAYS FOR LATER USE --
--
-- SCREEN ARRAYS --
SCREEN_TOP    = 1
SCREEN_BOTTOM = 0

-- THIS SETS UP THE TWO LAYERS FOR THE TOP SCREEN --
--
BGTile1Top = Screen.LoadTileBG()
BGTile2Top = Screen.LoadTileBG()
Screen.Initialize( SCREEN_TOP, BGTile1Top, BGTile2Top )

-- Create 1st Tile Layer --
BGTopMap = Screen.LoadTileBG()

-- Create 2nd Tile Layer --
BGTopMap = Screen.LoadTileBG()

-- Loads the Background --
BGTopMap:LoadPalette( "Space.bmp.pal" )

-- Loads the Tile data --
BGTopMap:LoadTiles( "Space.raw", 256 )

-- Loads the map data --
BGTopMap:LoadMap( "Space.map", ( 256 / 8 ), ( 192 / 8 ) )

-- Initialize Top screen --
Screen.Initialize( SCREEN_BOTTOM, BGBottomMap )

Tell me if you want me to put the packed NDS file on my site so that you can see what happens.
Logged
LeightonW87
Waxing Crescent
**
Posts: 17


« Reply #1 on: July 21, 2006, 03:14:18 PM »

I kinda fixed it, With only 1 background though Sad *Cries with shame*

Code:
-- THIS DEFINES THE NAMES OF ARRAYS FOR LATER USE --
--
-- SCREEN ARRAYS --
SCREEN_TOP    = 1
SCREEN_BOTTOM = 0

-- Create 1st Tile Layer --
BGTopMap = Screen.LoadTileBG()

-- Loads the Background --
BGTopMap:LoadPalette( "stars.bmp.pal" )

-- Loads the Tile data --
BGTopMap:LoadTiles( "stars.raw", 256 )

-- Loads the map data --
BGTopMap:LoadMap( "stars.map", ( 256 / 8 ), ( 192 / 8 ) )

-- Initialize Top screen --
Screen.Initialize( SCREEN_TOP, BGTopMap )

while true do
if Pads.Start() then
break
end
end

I don't have a clue what I was on when I entered the code in the post above. Cheesy

But for some reason it doesn't look right. Cry
Logged
Zhen
Waxing Crescent
**
Posts: 45


WWW
« Reply #2 on: July 22, 2006, 05:56:38 AM »

I think that you have two thinks wrong.

The first one and worst one, You use the variable BGBottomMap  without assign a value. So the value of BGBottomMap is nil. This can be the problem of the emulator crash.

The second one, you assign two different layers to the same variable. So you lost the reference of the first layer. The first layer will be eliminated by the Garbage Collection  ( the process that delete the data that nobody uses )

Code:
-- Create 1st Tile Layer --
BGTopMap = Screen.LoadTileBG()

-- Create 2nd Tile Layer --
BGTopMap = Screen.LoadTileBG()

Zhen
Logged
daltonlaffs
First Quarter
***
Posts: 189


Freaking Insane


WWW
« Reply #3 on: July 22, 2006, 07:21:06 AM »

Oh yeah, he's good  Grin
Logged

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



^^ That works, I SWEAR! ^^
LeightonW87
Waxing Crescent
**
Posts: 17


« Reply #4 on: July 22, 2006, 01:38:42 PM »

I can see what you mean, lol Cheesy I never noticed that. Tongue
Logged
Pages: [1]
« previous next »
    Jump to: