[Example] Bomb dropping game


#1

This is a simple bomb dropping game showing basic techniques on:

  • Camera hovering over a map.
  • Dynamic variables.
  • Dynamic object creation and positioning.
  • And others.

bomb_dropping

Download


[Solved] Text placement in a grand strategy game
#2

Cool game! I like it :smiley:

I reached max replies in another conversation with erdo, so posting my response here, this doesn’t have to do with the bomb dropping game. Also erdo, this is the last reply I can write today, so any future replies in the next 4 hours will just be edits to this post.

A few things to note: my game will have the whole world eventually, not just Iberia. This is just the provinces I have currently. The problem is if I set the name to the province in the center of the country, if the country loses/gains a lot of land, it’s not going to be in the center anymore. I need a reliable way the AI will set the name right in the middle at all times.
With your game the countries always stay the same size. What I want to do is when you win a way against a country, you can take some of their provinces. I made troops and the ability to move them around like 2-3 hours ago btw also. I did make the troop text dynamically, so each troop text is not its own thing, but text is created and shown on a province if it has one or more troops.
In my game, the countries aren’t objects. Each province is a separate object so I have like 100 objects. It might not be the most optimized way but that’s how I’m doing it. The countries are just variables. Each province has a country variable and it’s value is PORTUGAL, or CASTILE, etc.


#3

Well, it seems a great game you’re doing.

I did this to show you how to handle variables and basic object positioning at runtime, I wasn’t aiming to do the same game you’re doing (I’m currently developing something totally different to this, and it’s taking months). In any case, you need to understand the techniques used in my example game to achieve what you’re aiming for.

A formula to get the coordinates of the center of a region compossed by many objects is:

(rX,rY) = (o2.Y + ((o1.X - o2.Y) / 2), o4.Y + ((o3.X - o4.Y) / 2))

Where:

  • The pair (rX, rY) are the coordinates of the current center of the region (country, in your game)
  • o1 is the object (province, in your game) with the highest X coordinate and o2 the object with the lowest one
  • o3 is the object with the highest Y coordinate and o4 is the object with the lowest one