Not NaNo Day 3

Today was working on buildings, my goal was to be able to place and remove buildings. Just displaying them and the underlying code needed to track them and state changes. Nothing actually affecting game state, yet, but they need to draw and be tracked before I can do that. Another issue I had, that I haven’t tracked down yet, is the buildings don’t seem to be respecting the Alpha settings of my PNGs, they draw black where they should be transparent. I know that this does work properly, because my selection cursors use the alpha channel of the PNG to set transparency.

Right now I can draw buildings on the map that are already generated along with the terrain, but the mouse code should make it easy to add/remove them. The A, B and two half tiles are placeholders for buildings right now in the picture below.

offset selection
The selection is definitely offset from the mouse. Picture on my laptop, with 300% UI scaling, the offset issue is even more pronounced than at home.

I’ve also been trying to figure out why my sprites seem to have extra pixels added to them, and I came across a Stack Overflow post suggesting that it was a pyglet (the OpenGL library underlying cocos2d) issue with image scaling. Disabling the autoscaling made my images look better, but the still don’t quite align properly. I still think the alignment issue is a rounding issue rather than a cocos2d issue directly.

autoscale fix
No more artifacts on the edges of sprites as they’re being resampled/resized, but they still don’t quite align properly.

I didn’t spend much time working on my game as I was participating in Extra Life today, playing games, rather than working on one.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s