Two small problems

For questions about using Classic.

Post » Fri May 14, 2010 7:38 am

Hi, I have two problems in a game that I am working on, here's the cap: [url:2se2knuv]http://www.mediafire.com/?mjmm5xonmzj[/url:2se2knuv]

First problem: When you walk in the building (playerbox overlapping buildingfloor) both buildings become cutaway. I only want the building you're in to be cut away. How do I do this easily? Please keep in mind that there are going to be MANY buildings.

Second problem: When you press tab the buildings get chopped in half, but pressing tab again doesn't bring them back to normal.

Any help would be greatly appreciated!
B
3
S
1
G
3
Posts: 105
Reputation: 1,312

Post » Fri May 14, 2010 11:07 am

Here is the fixed cap: http://dl.dropbox.com/u/6660860/fixed.cap

The first problem was caused by construct not knowing which building to change so it just changed both of them.

The second problem was caused by your TAB presses both getting detected in the same tick causing the variable to not change. (I think that's what the problem was anyway).

One problem i can't seem to fix though is that when you press tab for the first time after launching the preview, it doesn't work but it works fine for all the presses after :S.

And finally, i have no idea what version of construct you made this in but it was older than what i saved it in (v0.99.84). So you might need to download the latest unstable build to see my changes and then just copy them in your real cap :).
B
7
S
2
G
4
Posts: 164
Reputation: 2,418

Post » Sat May 15, 2010 5:08 am

I got that same "TAB not working the first press" problem in a prototype I did recently, if anyone figures it out I'd like to know.
B
2
S
2
G
3
Posts: 114
Reputation: 1,553

Post » Sat May 15, 2010 9:43 pm

I'm not quite sure why the first press of TAB does not register in that .cap, but there is a better way to structure such a condition if it's just 2 states for the variable:

[code:3e365npy]+ MouseKeyboard: On key Tab pressed
+ System: Is global variable 'Chopped' Equal to 0 -> System: Set global variable 'Chopped' to 1
+ System: Else -> System: Set global variable 'Chopped' to 0[/code:3e365npy]

The TAB key is checked once, and if true, the global variable is checked as a sub-event, with an else clause for the second case.

Since it's easier to see the organization of events in a .cap, here's a fixed one (0.99.84):

[url:3e365npy]http://dl.dropbox.com/u/5868916/VirusSectorFix.cap[/url:3e365npy]

Anyway, this detects the TAB every time for me. I modified the Buildingfloor check above a bit too, though it worked fine before.
B
3
S
2
G
2
Posts: 187
Reputation: 1,449

Post » Sat May 15, 2010 11:15 pm

Thanks Silent Cacophony, i thought there must be a better way to do it. :wink:
B
7
S
2
G
4
Posts: 164
Reputation: 2,418

Post » Sun May 16, 2010 2:55 am

Thanks for the help guys, those problems are sorted now :)

One problems persists however. When you are in a building, pressing tab won't chop the buildings in half. The effect will only happen when you leave the building. I've tried and tried and can't seem to find why this is happening.

Here's the cap: [url:2iyk1zdr]https://dl-web.dropbox.com/get/Virus%20Sector.cap?w=ea0175dc&dl=1[/url:2iyk1zdr]
B
3
S
1
G
3
Posts: 105
Reputation: 1,312

Post » Sun May 16, 2010 5:30 am

Hi. Though I'm not entirely sure what the effect is that you are going for, I can say why the building won't get chopped while the player character is in it.

[code:2zl0dffx]+ Player1box: Player1box overlaps Buildingfloor
+ Building: Pick closest to: Buildingfloor.X, Buildingfloor.Y
-> Inside: Set animation to "Normal0"
-> Building: Set animation to "Cutaway"
+ System: Else
-> Inside: Set animation to "Normal" & Global('Chopped')
-> Building: Set animation to "Normal" & Global('Chopped')[/code:2zl0dffx]

Pressing tab modifies the global variable 'Chopped'. Notice that 'Chopped' is completely ignored if the player is in the building, as the animations are set specifically to"Normal0" and "Cutaway".

While the player is outside, the animations are set dynamically to "Normal" & Global('Chopped'), which does take into account the status of the global variable.

So, you need to work the status of 'Chopped' into the first condition somehow, as you did in the second.

Another thing I noticed is that the Inside object probably should be picked in a similar manner to the Building object for those conditions, if you don't want both to be changed as in your original problem.

I wasn't able to look at the animations in the cap, as Construct crashed when I tried any of them. I assume you use a version before 0.99.84. It seems to run fine, oddly enough. It may be worth checking that you can still access those if you are working with one of the posted caps.

Also, your cap link was bad in the last post.
B
3
S
2
G
2
Posts: 187
Reputation: 1,449

Post » Sun May 16, 2010 8:58 am

With help from your post Silent Cacophony, I've managed to fix the problem :) I've also upgraded my construct to the latest, which I somehow forgot to do.

I now face another dilemma, but this thread was really just for those small problems and I'm moving on to different things in the game now. I've created a journal thread for my game in the 'Your Creations' board.

[url:q1ej3s3y]http://www.scirra.com/forum/viewtopic.php?f=4&t=6410[/url:q1ej3s3y]
B
3
S
1
G
3
Posts: 105
Reputation: 1,312


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests