Reading levels on different external files in the same layou

Get help using Construct 2

Post » Tue Jan 19, 2016 5:49 pm

Hi there!

I'm making a puzzle game that requires lots of levels (around 100 or even more), but all of them have the same basic objects. I could make all the levels manually in different layouts, but it would be much better (and easier) if I could dinamically create levels by reading a .txt file for example, each file for a level. The idea is having only one layout that could handle all stages and loading them using a variable. I tried using AJAX to do this and it works fine, but I can't load a file using a variable's name I guess.

The idea is that I have a "level select" layout, let's say with 3 levels. All the levels go to to the same "game" layout, but setting a global variable when selected. Then, at the start of the "game" layout, I'd use the variable to know which .txt file I'd open (001.txt, 002.txt, 003.txt, etc) and then I'd create the level using the content of the file.

The problem is using the global variable name and opening the correct .txt file. Any ideas? Or better solutions? :mrgreen:

Thanks in advance!
B
53
S
12
G
7
Posts: 133
Reputation: 9,405

Post » Tue Jan 19, 2016 6:06 pm

...but I can't load a file using a variable's name I guess

How do I dynamically change the name of a XML file.
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Tue Jan 19, 2016 6:10 pm

Thanks!
B
53
S
12
G
7
Posts: 133
Reputation: 9,405


Return to How do I....?

Who is online

Users browsing this forum: matriax and 8 guests