How do I Generate Hexagon

Get help using Construct 2

Post » Fri Jul 18, 2014 3:00 pm

Hello, Ive been trying to do this on my own, but I had no real results. I am trying to make a generator that makes hexagon made out triangles. I want to make it like this: if i would make value of some global variable like 2, it would generate 2 layers of triangles, making hexagon, as in this picture Image

Its kinda hard to explain, but I have made this "generator", but the process is controlled manually, if you're interested you could look at it :)
datafilehost..com/d/5e063ea6 (remove 1 dot, since i cant post urls, sorry)
If someone could help me with this it would be great
B
6
Posts: 17
Reputation: 276

Post » Fri Jul 18, 2014 5:05 pm

Several weeks ago I made rectangles consist of 8 triangles arrange them by using loop 'for'. What you are trying to build isn't too far from my case. Basically it's kind of arithmetic & geometry things we need to figure out. I'll give a try to solve your quest (hopefully).

Let's give a shot:
A hexagon consist of 6 triangles. 2nd layer of perimeter is an increment from the core.
Think about this;
- each triangles of 'core' creates 3 more triangles outside to make 2nd layer
- same rule for 3rd layer but with more increment with 5 more triangles
- see? The increments was simple arithmetic, 1,3,5, ..and you can guess next increments
Last edited by alextro on Sat Jul 19, 2014 8:56 pm, edited 1 time in total.
ImageImage
B
111
S
51
G
24
Posts: 787
Reputation: 23,394

Post » Sat Jul 19, 2014 9:47 am

Thanks, Ill try it out, just one quick question, how can I add an action that is executed as soon the loop is over?
B
6
Posts: 17
Reputation: 276

Post » Sat Jul 19, 2014 8:54 pm

'trigger once' should do the trick.
While I'm spend time working the generator, here is visual guide to start with:
Image
ImageImage
B
111
S
51
G
24
Posts: 787
Reputation: 23,394

Post » Sun Jul 20, 2014 12:56 pm

Thanks, I can generate half of the hexagon, but I don't want to generate to other side, just copy it and rotate it.
My question is how can I rotate all objects as one

Edit: Never mind, played around with rotate and pin, the trick was to use rotate clockwise not set angle
B
6
Posts: 17
Reputation: 276

Post » Sun Jul 20, 2014 5:11 pm

Now I have new problem, I use UID to spawn sprites for hexagon. Everything works perfect, but if i place something in like text box, everything goes wild. And if i delete text box afterwards it still gets bugged out. But if I load previous save(where I have not placed text box) it works again...
B
6
Posts: 17
Reputation: 276

Post » Mon Jul 21, 2014 9:56 am

In my experience, I'm less using UID. I prefer IID since they are update dynamically on runtime.

Allright I made the hexa_tris generator. Try to compare it with yours.
You do not have the required permissions to view the files attached to this post.
ImageImage
B
111
S
51
G
24
Posts: 787
Reputation: 23,394

Post » Mon Jul 21, 2014 11:33 am

Well, I am using construct 2 for about a week now, so I do everything by flat logic. Here's what I made.

I think the main thing that is different from your generator is that I use flipped triangles instead of rotated, because my goal is to make the game pixelated and if i rotate triangle it becomes screwed up...
You do not have the required permissions to view the files attached to this post.
B
6
Posts: 17
Reputation: 276

Post » Mon Jul 21, 2014 12:39 pm

Is it possible to save generated hexagon, and load it afterwards, without any generating?
B
6
Posts: 17
Reputation: 276

Post » Mon Jul 21, 2014 6:04 pm

Funny, my first attempt was make the triangles flip. I believe it is not too difficult lo load what has been generated before by retrieve data from stored information in text format.

Will dig into this, or you can search the topic in forum first.
ImageImage
B
111
S
51
G
24
Posts: 787
Reputation: 23,394

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests