Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1153326 Posts in 48811 Topics- by 40017 Members - Latest Member: mrcxss

September 04, 2015, 08:34:02 am

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsFeedbackDevLogsFragment wars - Bullet hell for android
Pages: [1]
Print
Author Topic: Fragment wars - Bullet hell for android  (Read 150 times)
MajorCM
Level 0
*


View Profile
« on: May 28, 2015, 04:41:53 pm »

It's all relatively simple, but I'll be explaining a lot of the programming as I go. I chose Corona/Lua for this project because it'll be easy to port to iOS in the future. The tradeoff here is that it's aggressively slow.

Usually I let objects just draw themselves; This time I need to sort objects, and corona lacks a built in depth sort. I have to sort them myself and then add them to groups in the proper order.

To simplify things, there will only be three layers. Everything below (Tiles, grass, etc), sortable objects (Walls, characters, bullets) and everything above (particles and clouds).

Object sorting is simple, though. The further up something is on the screen, the more 'behind' that object is.

This means I just have to sort objects by their y-coordinate, and draw them in the list's order. Removing objects is easy, and if I have to add an object I can just shove it in the middle and sort it again.

Tune in next week where I google "Sorting algorithim" and then ultimately decide to go with one someone else has written for me.

« Last Edit: June 14, 2015, 08:08:42 am by MajorCM » Logged
MajorCM
Level 0
*


View Profile
« Reply #1 on: May 28, 2015, 04:54:05 pm »

That diagram was awful. Just awful.


Now, here, the red line is our depth axis; That's what would essentially be our 'y' axis in game.


Here's what it'd look like topdown, which is how it'd be represented in memory. If we drew them in the order of their lowest to highest values on the depth axis, you'd get sphere - house - cylinder.

Logged
MajorCM
Level 0
*


View Profile
« Reply #2 on: June 14, 2015, 08:08:18 am »

I completely forgot about this! Corona proved too limited, so I've started moving over to Unity. It's substantially faster, even for 2D. I wrote a Tiled importer and started learning about component-based design.

I'm liking it so far, but it took some time before it actually saved me any work. I wrote a simple component for walking to a target, then one for lunging, and another for shooting. I was able to interchangeably apply them to enemy units.



An artist is going to save me from this art. Yes, the player is just a slightly stretched grass tile.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic