procedural generation using the "miner" method

Get help using Construct 2

Post » Sat Feb 25, 2012 7:21 am

I've been playing around trying to get this cave generator to work in Construct 2: http://www.scirra.com/forum/procedural-generation-for-beginnerspdf_topic43387.html

So far, I've been able to get the first example (from tutorial 1) working, but the second one is really giving me a hard time. I've tried to follow the tutorial as closely as possible, but I think I may have made some mistakes. Particularly, i'm not sure what the equivalent of the value "miner(2)-1", and similar, is in C2. I've been using "miner.At(2)-1".

Here's a link to my capx file: http://dl.dropbox.com/u/64045180/random_gen.capx

I'm pretty new to Arrays, but i've worked through several of the tutorials and i thought i was on the right track. Does anyone see anything obviously wrong about the method i've used?
B
22
S
4
G
1
Posts: 38
Reputation: 2,081

Post » Sat Feb 25, 2012 5:14 pm

I never tried this, but I am currently trying to create a map generator, so i will try Tutorial and get back to you - If no one else does :)
B
193
S
6
G
7
Posts: 213
Reputation: 10,203

Post » Sat Feb 25, 2012 6:06 pm

The main difference is CC's arrays are 1 based and C2's arrays are 0 based. So you have to change the expressions from "miner.At(2)-1" to miner.At(1)-1".

Also when you generate a random direction you're using "int(random(4))+1" which will give you 1,2,3 or 4, and since you're comparing against 0,1,2 and 3 you should change the expression to just "int(random(4))".

Fixed cap:
http://dl.dropbox.com/u/5426011/examples%209/yanen_miner.capx
B
92
S
32
G
110
Posts: 5,298
Reputation: 71,507

Post » Sat Feb 25, 2012 6:09 pm

hmmm damne ninja'd
caveGeneration.capx
Last edited by Yann on Sun Sep 14, 2014 9:32 pm, edited 1 time in total.
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Sat Feb 25, 2012 11:58 pm

Ohhhhh, hadn't thought of that at all. Thank you guys so much. lol, spent the good part of last night beating my head against the wall trying to figure it out. :D
B
22
S
4
G
1
Posts: 38
Reputation: 2,081


Return to How do I....?

Who is online

Users browsing this forum: ametueraspirant, dand, mickclarke and 24 guests