Check out the new forum. You are currently viewing the old forum. It will be saved and searchable for future reference.

HomeForumGeneral DiscussionMy first Game Level wont load

Author Posts
Author Posts
November 7, 2010 at 9:10 pm #237

Renegade

Hi,
My first Game Level wont load (I’m at page 34 in the book)
I’ve correctly changed
[GameScene newGame:@”level1.tmx”];
to
[GameScene newGame:@”leveltest.tmx”];
I’m not getting any build errors
and no runtime errors by what i can tell
here is what my console looks like

[Session started at 2010-11-07 13:38:43 -0700.]
2010-11-07 13:38:47.141 QuexlorLite[17573:207] Game is running in normal resolution mode
2010-11-07 13:38:47.145 QuexlorLite[17573:207] Couldn’t load game state, so initialized with defaults
2010-11-07 13:38:47.154 QuexlorLite[17573:207] GameState init level='(null)’, previous='(null)’, life=50.0, maxLife=50.0, strength=5.0, dexterity=5.0, swordLevel=0, experience=0, usableExperience=0, bones=0, misc=(null)
2010-11-07 13:38:47.156 QuexlorLite[17573:207] Loaded game state level='(null)’, previous='(null)’, life=50.0, maxLife=50.0, strength=5.0, dexterity=5.0, swordLevel=0, experience=0, usableExperience=0, bones=0, misc=(null)
AudioStreamBasicDescription: 2 ch, 44100 Hz, ‘lpcm’ (0x00000C2C) 8.24-bit little-endian signed integer, deinterleaved
2010-11-07 13:38:47.496 QuexlorLite[17573:2c03] AddRunningClient starting device on non-zero client count
Stack dump:
0. Running pass ‘Combine redundant instructions’ on function ‘@gleLLVMVecPrimMultiRender26′

here is whats happening
the app loads to the main menu
i press start new game
and the app crashes every time

the level file leveltest.tmx is in the copy bundle resources file
I’ve done everything the book says to look for
I cannot get it to work
Can you help me?

November 8, 2010 at 6:40 pm #838

Boreira

Did you try to run it with the debugger disabled? If that worked then try below:

Use gcc4.2 compiler in project – Edit Project Settings -Build- compiler version and pick gcc4.2

November 8, 2010 at 9:07 pm #839

Nathanael Weiss

Hmmm.. sounds like something might be accidentally funky with your leveltest.tmx.

Does it run level1.tmx okay?

What version of Tiled are you using?

If you haven’t yet got it to work, please post the contents of your leveltest.tmx here and also email me a copy at feedback (at) iphonegamekit (dot) com.

November 10, 2010 at 1:41 am #840

Renegade

level1.tmx runs fine

tiled v0.5.1

<?xml version=”1.0″ encoding=”UTF-8″?>
<map version=”1.0″ orientation=”orthogonal” width=”10″ height=”10″ tilewidth=”64″ tileheight=”64″>
<tileset firstgid=”1″ name=”grundvari tileset” tilewidth=”64″ tileheight=”64″>
<image source=”Art/Tiles/grundvari tileset.png”/>
</tileset>
<layer name=”Tile Layer 1″ width=”10″ height=”10″>
<data encoding=”base64″ compression=”gzip”>
H4sIAAAAAAAAA2NhYGBgGcWDBgMAwwVleZABAAA=
</data>
</layer>
<layer name=”Tile Layer 2″ width=”10″ height=”10″>
<properties>
<property name=”objects” value=”1″/>
</properties>
<data encoding=”base64″ compression=”gzip”>
H4sIAAAAAAAAA2NgQAUyDMQBaqsjFgyU+6jtD1wAAMtPid+QAQAA
</data>
</layer>
<objectgroup name=”Object Layer 1″ width=”10″ height=”10″>
<object name=”” type=”player” x=”107″ y=”145″/>
<object name=”” type=”sword” x=”228″ y=”157″/>
<object name=”” type=”skeleton” x=”396″ y=”335″/>
</objectgroup>
</map>

November 10, 2010 at 9:11 am #841

Nathanael Weiss

There’s two issues with this level file:

1. The tileset image “Art/Tiles/grundvari tileset.png” is a relative path (Cocos2D won’t be able to find it).
2. “grundvari tileset.png” needs to be a part of your Xcode project.

Here’s how to fix it:

1. Copy “grundvari tileset.png” to your project’s “art” directory (same directory as leveltest.tmx)
2. Add it to your Xcode project by right-clicking on the “Art > Levels” group and doing an “Add > Existing Files…”
3. Edit your leveltest.tmx by hand and change “Art/Tiles/grundvari tileset.png” to just “grundvari tileset.png”

The book mentions this pitfall on page 25, but it should be clearer. I’ll improve that page on the next release.

November 10, 2010 at 7:48 pm #844

Renegade

it works great now
thanks