Levels.... how???

For questions about using Classic.

Post » Thu Sep 25, 2008 8:12 pm

Currently there are 3 options for levels in a game :

1) Different layouts
2) Arrays
3) Built in Save/Load


But I have to create a save file not too complex and not too simple. I have different objects on playfield and 3, 4 global variables. Is there any way I can save all to a text file like this?

[code:5i6cqax7]2 // number objects
var1 // global var 1
var2 // global val 2
obj1x // ***
obj1y
obj2x
obj2y[/code:5i6cqax7]


*** = Construct reads the first line (2) and after reading the global variables it does a Repeat loop with (2 * 2). In fact, the repeat loop should work like this :

[code:5i6cqax7]read line 1 -> put in variable 1
NEXT LINE
read line 2 -> put in variable 2
spawn object at var1 var2
NEXT LINE - REPEAT[/code:5i6cqax7]
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Sat Sep 27, 2008 10:41 am

I would use Ini files for stuff like that really, it allows you to save the information with a little structure and doesn't take much work to achieve what you want.

Edit: Ill give a small example
[code:3amtz2po][Global]
Var1 = variable
Var2 = variable
NumObjs = 2

[Obj1]
X = ***
Y = ***

[Obj2]
X = ***
Y = ***[/code:3amtz2po]

Although you would probably need a "TypeObj" in each Obj group so you can create more than one type of object.
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sat Sep 27, 2008 1:48 pm

I don't really get INI object...

I want something like :

Read line X
Read next line

Not groups stuff... But if you can demostrate me with an example...
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Sat Sep 27, 2008 2:19 pm

This is exactly what I've been trying to do. Only I've been attempting to use arrays and have one for each different type of object. So far I've failed epically and doing this. :(
B
2
S
2
G
4
Posts: 136
Reputation: 1,722

Post » Sat Sep 27, 2008 2:22 pm

[quote="SuperV":3sk60v1c]Not groups stuff... But if you can demostrate me with an example...[/quote:3sk60v1c]

Ok i'll see if I can whip something up for ya, you want it to be able to define how many objects there are and where they are placed, from the INI file right??
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Sat Sep 27, 2008 2:26 pm

[quote="Jayjay":15yk3mg4][quote="SuperV":15yk3mg4]Not groups stuff... But if you can demostrate me with an example...[/quote:15yk3mg4]

Ok i'll see if I can whip something up for ya, you want it to be able to define how many objects there are and where they are placed, from the INI file right??[/quote:15yk3mg4]

I just want this :

NumberObjs = 2
Obj1X= 3
Obj1Y = 5
Obj2X = 6
Obj2Y = 7
B
2
S
2
G
5
Posts: 512
Reputation: 2,674

Post » Sat Sep 27, 2008 2:27 pm

Cool, should be simple enough :)

EDIT: Here you go, even supports placement of two different objects (although it will work with the same object)

[url:3pn89pix]http://www.scirra.com/phpBB3/viewtopic.php?f=16&t=1721[/url:3pn89pix]
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests