These are chat archives for monodop/cs413_tiles

25th
Mar 2015
Cykon
@Cykon
Mar 25 2015 00:06
update your flash player
Sw33tT00th
@Sw33tT00th
Mar 25 2015 00:29
flash is up to date, that's not the issue
Cykon
@Cykon
Mar 25 2015 00:39
run it with a debug player to see if any errors are being thrown
Sw33tT00th
@Sw33tT00th
Mar 25 2015 00:45
ah ha! can't run it in the browser
Sw33tT00th
@Sw33tT00th
Mar 25 2015 00:54
does anyone remember palmer's github username?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 01:48
can we use external stuff for tilemap loading? I can't find anything on how this is done without something like HaxePunk or HaxeFlixel
Sw33tT00th
@Sw33tT00th
Mar 25 2015 02:11
For the life of me I can't find the demo code that was shown in class anywhere, and I can't find any examples anywhere online that don't use something like HaxeFlixel or the like. Where is the code that was demonstrated in class and were specifically told we should probably use?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 02:36
is anyone on here right now?
Cykon
@Cykon
Mar 25 2015 03:18
I am but I don't know anything about demo code
I'd just write it from scratch
Harrison Lambeth
@monodop
Mar 25 2015 04:29
ok I'm here
Sw33tT00th
@Sw33tT00th
Mar 25 2015 04:46
ok, sweet, I was trying to figure out where to put the Tilemap into
Harrison Lambeth
@monodop
Mar 25 2015 04:46
I'm going to give you some code
Sw33tT00th
@Sw33tT00th
Mar 25 2015 04:46
https://github.com/sebaqu11/cs413_tiles/blob/master/src/Game.hx
this is the only place where I've see some example
I need to be able to pass it the assetmanager as well as the xml from the .tmx file that tiled creates
Harrison Lambeth
@monodop
Mar 25 2015 04:47
oh
yeah
So in the game.World class
You can probably put the tilemap in there
in the new method
Sw33tT00th
@Sw33tT00th
Mar 25 2015 04:49
ok, how can I access the assetManager from there?
Harrison Lambeth
@monodop
Mar 25 2015 04:49
Root.assets?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 04:49
ok
Harrison Lambeth
@monodop
Mar 25 2015 04:50
Sw33tT00th
@Sw33tT00th
Mar 25 2015 04:51
I was actually just on that page about 5 seconds before you sent it :) yay google
Harrison Lambeth
@monodop
Mar 25 2015 04:51
lol
so yeah, the name of the asset is whatever is after the @
Harrison Lambeth
@monodop
Mar 25 2015 05:20
any progress?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:20
not really, I can't get the string from the file
Harrison Lambeth
@monodop
Mar 25 2015 05:20
really?
what happens?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:21
nothing, which is the problem, I get null back if I do it the way from that one page, and I can't get that -resource line to do anything
I'm trying it via Xml.parse and all it's storing is the filename, not the content of the file
or rather the path that I pass into the parse() function
Harrison Lambeth
@monodop
Mar 25 2015 05:22
try loading it in using the assetmanager
var byteArray = Root.assets.getByteArray(levelFile);
assets.enqueue("assets/levels/map.tmx");
enqueue in Root.hx and load that where you want the text version
try that and see if it works
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:24
when you say levelFile, is that supposed to be the path?
should it be a string?
Harrison Lambeth
@monodop
Mar 25 2015 05:24
in this case it would be "map"
because it's map.tmx
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:25
ok
Harrison Lambeth
@monodop
Mar 25 2015 05:25
but it's whatever you named your map
sorry I just pulled those lines from edutainment
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:26
is levelFile a variable?
Harrison Lambeth
@monodop
Mar 25 2015 05:28
it could be whatever
It's like loading a texture or whatever
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:32
now that it's stored I don't know how to access it since I've never done anything like this before
Harrison Lambeth
@monodop
Mar 25 2015 05:33
what's stored
the byte array?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:33
yeah, which is the xml file which I need to pass as a string to the Tilemap class
Harrison Lambeth
@monodop
Mar 25 2015 05:34
So you need to convert the byte array to whatever the tilemap constructor wants
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:34
but how do I actually reference the byte array?
wait... nevermind
Harrison Lambeth
@monodop
Mar 25 2015 05:34
lol
so you do the Root.assets.getByteArray inside where you need it
so in World.hx or whatever
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:41
ok, I'm getting really frustrated with this as it's almost time for me to go to sleep, I can't find anything about converting the ByteArray object back into a string, lots about doing just the opposite though
Harrison Lambeth
@monodop
Mar 25 2015 05:43
can't you just .toString()?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:43
that throws a rather remarkable error
Harrison Lambeth
@monodop
Mar 25 2015 05:43
really?
what error
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:44
well now it doesn't say anything, it threw it once and now it won't display, instead it just stops working immediatly
map = new Tilemap(Root.assets, byteArray.toString());
that's what I'm trying to run
Harrison Lambeth
@monodop
Mar 25 2015 05:45
what happens if you trace(byteArray.toString())
and then don't load the map to see what it comes up with
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:46
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at game::World()[src/game/World.hx:34]
at menus::Game/init()[src/menus/Game.hx:21]
at menus::MenuState/start()[src/menus/MenuState.hx:34]
at MethodInfo-14()[src/Root.hx:64]
at Function/<anonymous>()[/Users/redge/Dropbox/Development/starling/starling/src/starling/utils/AssetManager.as:742]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at SetIntervalTimer/onTimer()
at flash.utils::Timer/_timerDispatch()
at flash.utils::Timer/tick()
that is what happens
Harrison Lambeth
@monodop
Mar 25 2015 05:46
Looks like byteArray might be null then
are you sure your asset is in the right spot?
and the names match?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:47
it's in the assets directory and the filename is definatly "ShittyTilemap.tmx"
Root.assets.enqueue("assets/ShittyTilemap.tmx");
var byteArray = Root.assets.getByteArray("ShittyTilemap");
Harrison Lambeth
@monodop
Mar 25 2015 05:47
and byteArray is null?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:47
that's what the error claims
Harrison Lambeth
@monodop
Mar 25 2015 05:48
wut
wait
where are you doing the enqueue
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:48
if it isn't clear, I have no idea what I'm doing
Harrison Lambeth
@monodop
Mar 25 2015 05:48
where are you doing the enqueue
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:49
I've tried it in that order and the other way around, they both yeild the same error
Harrison Lambeth
@monodop
Mar 25 2015 05:49
ok do
ok so
You need to enqueue it with the rest of the assets
in Root.hx
and then getByteArray where you need to load it
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:50
same error
assets.enqueue is in the Root.hx file, and the byteArray is being gathered in the World.hx
Harrison Lambeth
@monodop
Mar 25 2015 05:51
Can I see the code for both?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:52
you want me to just push on another branch?
Harrison Lambeth
@monodop
Mar 25 2015 05:52
that or pastebin
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:54
ok, there is a new branch called TilemapIssues
Harrison Lambeth
@monodop
Mar 25 2015 05:59
oh whoa
check out Tilemap.hx:59
Sw33tT00th
@Sw33tT00th
Mar 25 2015 05:59
...? did I put that in? shit
Harrison Lambeth
@monodop
Mar 25 2015 06:00
no I think that came with it
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:00
so does that mean that the xml is just a path?
Harrison Lambeth
@monodop
Mar 25 2015 06:00
it's the assetname
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:00
huh
that still crashes it, but without any information
Harrison Lambeth
@monodop
Mar 25 2015 06:02
do you have a -debug flag going?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:02
yes
Harrison Lambeth
@monodop
Mar 25 2015 06:02
I did
map = new Tilemap(Root.assets, "map");
addChild(map);
and I get missing texture errors
make sure in Tiled your assets are relative to the project
because right now it's looking for like
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:03
why "map"? the file is called "ShittyTilemap.tmx"
Harrison Lambeth
@monodop
Mar 25 2015 06:03
../../../ShittyWater
because I did
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:03
hmm
Harrison Lambeth
@monodop
Mar 25 2015 06:03
in my haxe compilation
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:04
so that's where it goes
Harrison Lambeth
@monodop
Mar 25 2015 06:04
yeah
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:04
yeah, that wasn't clear before
Harrison Lambeth
@monodop
Mar 25 2015 06:05
haxe \
-cp src \
-cp vendor \
-swf-version 11.8 \
-swf-header 512:384:60:000000 \
-main Startup \
-swf game.swf \
-swf-lib vendor/starling_1_6.swc --macro "patchTypes('vendor/starling.patch')" \
-resource assets/ShittyTilemap.tmx@map \
-debug
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:09
I think the xml get's exported incorrectly
Harrison Lambeth
@monodop
Mar 25 2015 06:10
why?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:10
if you look at the IDs in the xml you see 0 and 1, but the actual <tile gid="2"/> elements are all over the place
Harrison Lambeth
@monodop
Mar 25 2015 06:10
Did you fix the texture thing yet?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:11
yeah, let me commit and push
pushed
Harrison Lambeth
@monodop
Mar 25 2015 06:12
ok it's still missing textures
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:13
yeah, because the tiled exported xml is trying to reference tiles that don't exist
I think I need to remake that -_-
Harrison Lambeth
@monodop
Mar 25 2015 06:13
I don't think so
The main issue is you never enqueue the assets it's trying to load
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:13
the tile images?
Harrison Lambeth
@monodop
Mar 25 2015 06:14
yeah
It's looking for "/Tiles/ShittyBeach.png"
but that's not a valid asset
because it hasn't been enqueued
I'd throw the tiles into a tilemap and then name them how you are trying to load them
then enqueue the tilemap
err
tileset*
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:15
like this:
assets.enqueue("assets/Tiles/ShittyWater.png");
assets.enqueue("assets/Tiles/ShittyBeach.png");
?
because that didn't work
Harrison Lambeth
@monodop
Mar 25 2015 06:16
Right, because that's adding "ShittyWater" and "ShittyBeach" as assets
not /Tiles/ShittyWater.png or /Tiles/ShittyBeach.png
So you want the tiled tilemap to use the names ShittyWater and ShittyBeach
One way to do that is just rename them in the tilemap itself
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:17
I have no idea what you are on about
Harrison Lambeth
@monodop
Mar 25 2015 06:17
when you enqueued the shit
it named it the filename without the extension or path
the tilemap is trying to access it using the extension and path
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:18
ok, so in the .tmx I need to change those references to just ShittyWater and ShittyBeach?
Harrison Lambeth
@monodop
Mar 25 2015 06:18
yeah
try that and see what happens
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:19
I'm still getting the same error
Harrison Lambeth
@monodop
Mar 25 2015 06:19
null texture?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:19
yeah
Harrison Lambeth
@monodop
Mar 25 2015 06:24
Can you bring your computer and stuff to class tomorrow and we can work on it then?
if there's time during lecture?
Sw33tT00th
@Sw33tT00th
Mar 25 2015 06:25
I'm working on my desktop now, but I can set it up on my laptop during the beginning of class
Harrison Lambeth
@monodop
Mar 25 2015 06:25
ok cool
David Terry
@FlintyFalcon
Mar 25 2015 06:27
Hey guys so I'm being super colorblind right now lol
i can't figure out if what i'm making looks right or not
also
is the ship the same size as the other tiles?
Harrison Lambeth
@monodop
Mar 25 2015 06:28
whatever makes sense
Cykon
@Cykon
Mar 25 2015 06:31
lol
David Terry
@FlintyFalcon
Mar 25 2015 08:21
dunno if anyone is up, but did we decide if we could try and put animations in the tiles themselves?
cuz the animation is easy, as it happens.
and ocean effects are a possibility
Harrison Lambeth
@monodop
Mar 25 2015 08:52
We'd like to have them
Harrison Lambeth
@monodop
Mar 25 2015 22:53
@Sw33tT00th I put up a copy of some tile code from ShieldStorm on pastebin if you're interested.
I accidentally left in Wall.getContactPoints and Wall._isBlocking
you can ignore those, since they had to do with the LOS calculations
oh I forgot the update code
Harrison Lambeth
@monodop
Mar 25 2015 23:00
Ok I updated the paste
You can implement this into a custom class if you want, or you can do it the same way I did
it'd be nice as it's own standalone class though