Beginners Quesion: Problem with Layouts

Discussion and feedback on Construct 2

Post » Tue Nov 29, 2011 2:53 pm

Hello, im new to this program and are very soon done with my first game.
I was using only one layout and then when i were going to complete the game, i added my second Layout with a Eventsheet.

I asume the evensheet follow the layout and only aplies to that one?
Hence, Layout2 follows the instructions on event sheet 2?

To the problem, i must missunderstand something about layouts, because i use layout 2 for the menu and then when i click start, it changes to layout 1 for the game. Problem is that it dosent count variables as it should be. Ive set for some variables to count and give limits to how many objects that there may be, but those dosent work.

Anyone that can help and explain what im doing wrong?
Ill try this way, before uploading the game.

(i use no scripts, only the eventsheets) <- and like to keep it that way.
B
11
S
2
G
2
Posts: 18
Reputation: 1,913

Post » Tue Nov 29, 2011 4:32 pm

If you could post your capx, it would be easier to spot on what went wrong.
From the sound of it, I'd say select your layouts in the "Projects" tab and make sure that their "Event sheet" property links to the intended events sheet.
This might be a first thing.

Another thing is the order of the layouts.
If you have some variables and code for these variable set in event sheet 2/layout 2/Menu in you case and that you start directly the program on layout game, the whole code about the variables won't act indeed, since the layout they are in never got initialised.

Make sure that the correct layout is selected as "First layout" property of the project itself.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Nov 30, 2011 3:12 pm

I still cant get it to work.
Here is the game.
GAME
B
11
S
2
G
2
Posts: 18
Reputation: 1,913

Post » Wed Nov 30, 2011 4:12 pm

Your code is pretty messy, it's hard to get into it.
You're setting no variable in the menu layout, so there's nothing there, the variables are setted in Game sheet anyway.
So the problem must be elsewhere.

Anyway, what is the problem exactly ? What do you expect your code as it is to do ? What is it doing instead ?
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Wed Nov 30, 2011 6:28 pm

[QUOTE=Kyatric] Your code is pretty messy, it's hard to get into it ...[/QUOTE]
Yes, how about adding some comments in your event sheet, maldrok?Velojet2011-11-30 18:29:41
B
105
S
20
G
12
Posts: 549
Reputation: 20,320

Post » Wed Nov 30, 2011 8:46 pm

There we go, ive added lots of comments and groups and also translated all the names from swedish ones to english ;D + simplified some code, that i made too advanced, when i began coding.

Here is the new one
https://rapidshare.com/files/1446093042/NewGame.rar

To the problem:
When i click on the PILE1 to spawn a BOARD1, then it should count +1 on a variable. When that variable is 2, then it shouldnt be able to spawn more.
This works when i start the game from the GAME LAYOUT.
But when i start from the TITLE LAYOUT, then it dosent, they just keep spawning when i click on the PILE1
B
11
S
2
G
2
Posts: 18
Reputation: 1,913

Post » Wed Nov 30, 2011 10:37 pm

I can't seem to be able to download your file.
Rapidshare is acting strange, and really badly wears its name anyway.

You should consider hosting your files on dropbox if possible, it really facilitate files exchanges.

For now some quick fixed capx of your project.
I reorganised a bit of events but it still is messy.

Pile1 and Pile2 NrOfPlanks starts at -1 when running from the menu.
I'm not sure exactly why, the solution for this is to set those values to 1 in the startup of layout.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Thu Dec 01, 2011 12:08 am

you do not need this NOTEXIST boolean
if you want to know if there's a board in the scene, just count them
plywood.capx
here you go, you just have to understand what I did for the small boards and apply that to the big ones.

Also Kyat is right, having dropbox makes you sexy and smell good... A dropbox account and you will be surrounded by women in no time!
Last edited by Yann on Sun Sep 14, 2014 10:57 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Thu Dec 01, 2011 7:04 am

Thanks for the DropBox tip, i allready got a woman, but sure as hell could use more.
http://dl.dropbox.com/u/51673505/NewGame.rar <- should be my new gamefile.
B
11
S
2
G
2
Posts: 18
Reputation: 1,913

Post » Thu Dec 01, 2011 7:41 am

There we go, i made some major changes in the code, using what you suggested Yann, thanks. So now there is fewer Boolean Variables and more Global Variables or just checks for how many of an object that is out.

I also added test-text that display the variables counting and you were right Kyatric. They start at -1, but even if i do "At start of Layout" and set them to 0, they still remain at -1 when running from the menu.

http://dl.dropbox.com/u/51673505/NewGame.rar

EDIT: I just got it to work, by putting a Wait:0.1 seconds int the middle of the
"Start of layout". Maybe it was to much sh*t running in that code.maldrok2011-12-01 07:45:47
B
11
S
2
G
2
Posts: 18
Reputation: 1,913

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 13 guests