Two small problems

This forum is currently in read-only mode.
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • Hi, I have two problems in a game that I am working on, here's the cap: http://www.mediafire.com/?mjmm5xonmzj

    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!

  • 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 .

  • 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.

  • 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:

    + 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]http://dl.dropbox.com/u/5868916/VirusSectorFix.cap[/url]
    
    Anyway, this detects the TAB every time for me. I modified the Buildingfloor check above a bit too, though it worked fine before.
  • Thanks Silent Cacophony, i thought there must be a better way to do it.

  • 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: https://dl-web.dropbox.com/get/Virus%20Sector.cap?w=ea0175dc&dl=1

  • 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.

    + 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 [i]'Chopped'[/i]. Notice that [i]'Chopped'[/i] is completely ignored if the player is in the building, as the animations are set specifically to[i]"Normal0"[/i] and [i]"Cutaway"[/i].
    
    While the player is outside, the animations are set dynamically to [i]"Normal" & Global('Chopped')[/i], which does take into account the status of the global variable.
    
    So, you need to work the status of [i]'Chopped'[/i] into the first condition somehow, as you did in the second.
    
    Another thing I noticed is that the [b]Inside[/b] object probably should be picked in a similar manner to the [b]Building[/b] 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.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

    http://www.scirra.com/forum/viewtopic.php?f=4&t=6410

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)