#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Create a zone

Posts: 11Member
edited November 2017

Hello

It is hard to explain what I want the game to do/understand exactly using only words. I hope screenshots will help.

Basically, here is my starting screen:

I want the game to understand that the starting screen is made of an area representing 100%

The black dot at the bottom can draw line. Once the line "close" an area. I want the game to understand that this is a specific zone split in percent. Something like this:

And I want the 25% area to become purple because it is smaller than the 75%.

I have 0 idea of how doing such a thing... Seems simple I guess but maybe not...?

Thank you

• Posts: 114Member, PRO

Hey Baazul,
This is quite serious. To be honest it's actually a sort of complex concept but it is certainly doable.
Basically what you'd need to do is set up some global attributes for two opposing corners of your "zone", and have those variables be procedurally set based on the corners of the line drawn. Like so:

The midpoint between the coordinates of those two corners would be the coordinates of your zone's location on screen. This can be calculated by subtracting the x and y coordinates of point 1 from point 2, dividing the result by 2, and then adding that result to point 1. Like so:

Then finally, you'd calculate the width and height of your zone. To do this, simply subtract point 1's Y coordinate from point 2's Y coordinate for the height, and subtract point 1's X coordinate from point 2's X coordinate for the width. Like so:

Now that you have the width and height of your zone as well as it's location, you have all the info you need. You can constrain a separate zone actor to these coordinates, or you can do it some other way- it's up to you.
Regardless, make sure you log all this data procedurally since it's constantly updating.

Hopefully I could help. If it doesn't seem to be working or if I'm completely off, feel free to let me know!

• Posts: 11Member

thank you for the answer, I am going to try to understand and apply it tomorrow and let you know

• Posts: 114Member, PRO

@baazul said:
thank you for the answer, I am going to try to understand and apply it tomorrow and let you know

Hopefully it works out well. That's an interesting concept you've got. Good luck

• Posts: 11Member
edited November 2017

I am trying to make this kind of game:

Also I think it would be cool if people can make round area instead of only square or rectangle. So maybe make the game to count the number of pixel inside each area and change the color of the smaller area would work better ?

As a beginner I wanted to start small. But it seems this game is not that easy. I understand most of your explanation but I don't know how to apply it. I think I just need to learn more first. I will start with something easier and get back to this project as soon as I feel ready.

• Posts: 114Member, PRO

Unfortunatley this would require a functionality that GS simply does not support. I was able to come up with this mockup... it's the best I could do for now. I'll keep looking into it though.

Hopefully it can help if only a little bit.

• Posts: 11Member

good job, yes it helps I am going to learn from how you did it, thank you

• Posts: 114Member, PRO

@baazul said:
good job, yes it helps I am going to learn from how you did it, thank you

I'm glad I could help. Best of luck to you.

• Posts: 164Member, PRO

I can try to help if you still need it.