Streak Club is a place for hosting and participating in creative streaks.
My journey with Luxe continues.
I got the parcels working and was able to import and display graphics now, so the placeholder graphics should disappear over the next day or two. I ran into some major headscratchers with importing textures and json files and having them be available to Luxe, but I figured them out after some frustration. My problems came with everything being loaded asynchronously. I thought that the Luxe ParcelLoader (which I thought was a preloader, but actually isn't) would hold the game until all the assets were finished loading but it doesn't. I had to add all my sprite and game initializations into a load_complete function and add if(sprite==null) return; to the top of my update() loop to prevent it from running before all the assets are loaded.
I wrote a pretty substantial blog post about it here.
Now that the cat is running in the game again I've cleared another major hurdle. Now once I get the remaining graphic assets in the game I'll be officially where I was at the end of last week when I switched the engine from HaxeFlixel. Actually, a little ahead because I have the collisions for the boxes and stuff working now and they weren't before. My last problem with the graphics is getting the sprite to display offset from the Shape that controls collisions. I'm sure it is a simple fix but I just haven't found it yet.
daily from
Post a comment
@Nico Coding the logic in the sprite itself would work around the particular issue with the update() function throwing errors, but I try to avoid it. I like to program in a MVC architecture (Model-View-Controller, in case you aren't familiar with it) whenever possible. I try to keep all the drawing logic and game logic separate so I can change one without messing with the other. In HaxeFlixel that was nearly impossible (it required way more work than it was worth) because the Sprite and the hitbox were completely connected, but in Luxe they are split into Sprite and Shape. So now I move around a shape and check collisions and then catch my sprite up to it in the update.You can see the shape drawn in pink in the GIF above.
Actually I was fighting for this problem for awhile before I realized what was happening. Once I made the change and got everything working I thought, "I wonder how they handle this in the examples because everything there is coded in Main.hx". Then I checked the Animating Sprites guide and sure enough the author did the same thing I did. It isn't stated in the written part of the guide, but if you look at the whole code it is there and commented.
Live and learn I guess!
hmmm, I was hoping to find something really wrong you were doing that I could help you with, but I think its your general approach, for instance, if you components/update logic on the sprite instead, you wouldn't need that null check, I never code logic in my Main class