Can someone look at my code and help me, please?

  • https://www.dropbox.com/s/0453cyepffeamga/fullv12.capx?dl=0

    I am new to the program and am making a game for a college class.

    I am running into an issue with the event sheet "RepairMenu", on line 227. For some reason, the key press isn't registering when set to "A", but it doesn't have an issue when set to anything else.

    Now, I know my code and project is extremely unprofessional, messy, and unstructured, but all I need to know is how to make that one part work. Any help as to what I need to change or add to fix it would be greatly appreciated.

    Thanks!

  • "On key pressed" is a triggered event (it has that little green arrow). Try not to use triggered events in sub-events.

    Also, you already have the same "On A pressed" event in line 231.

    Read about triggered events here:

    https://www.scirra.com/manual/75/how-events-work

    Is this what you were trying to make?

  • Thanks for replying so quickly! I didn't know about not using triggered events in sub-events.

    What I am trying to do with this event sheet is navigate a menu using the arrow keys and "A". On this step, the second to last step, the player is given a grid of three boxes and they need to navigate to one of the boxes. Once that is done and the box is highlighted, they need to input a code consisting of "A" and "B" presses.

    Right now, that is not possible because pressing "A" doesn't do anything.

    How would I fix it so that "A" can be used?

    I can also have it so that one of the boxes has to be selected first, which navigates to a different menu where the code then needs to be typed, but I still need "A" to work in order to navigate to that menu.

    Thank you so much for your help.

  • Use groups activation/deactivation.

    Make several groups - Menu Controls, Code Input, Box Selection etc.

    Move all keyboard events for Menu navigation to Menu Controls.

    Move all keyboard events for entering code to Code Input.

    Move all keyboard events for selecting boxes to Box Selection.

    Keep only one group active at a time.

    When player is in the menu, enable Menu Controls and disable Code Input and Box Selection groups.

    When player is about to input code, enable Code Input, disable other two.

    Or you can do this with variables, global or instance. For example:

    On keyboard A Pressed
        Compare variable currentAction="menu" ->   navigate left in the menu
        
        Compare variable currentAction="boxes" ->   move to the left box
    
        Compare variable currentAction="code" ->   input "A" into the code
    [/code:7yjo2vtv]
  • Thank you so much! Your suggestion for having global variables worked. Now, there's only one other thing I need help with.

    Is there an easy way to detect a series of key presses? Like, if the player presses "A, A, A" something happens, but if they press "A, A, B", something different happens?

    Thanks for your quick responses!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are a few plugins you can try:

    free -

    commercial -

    Full list -

  • Thanks so much, that helped, but I've run into another issue, and time is running out. I need help asap

    Here is where I am currently:

    https://www.dropbox.com/s/mgra5u68ft1yp ... .capx?dl=0

    I have the rex_sequence_matcher plugin and the rex_timeline plugins installed.

    Basically, I'm trying to get the menu to progress through choices, and I also want to supply the player with a back button.

    For some reason, when it needs to switch to Menu=5 ( Event sheet: RepairMenu, line: 216), the display changes back to Menu=0 (line: 54).

    If you can just tell me (with the exact code, preferably) what I need to do to make it so the menus change correctly AND the back buttons take the player back to the previous menu, all without having to redo a majority of the code (The project is due in two days) I'd really appreciate it, and I'll even give you a reward.

    If you really can't, I'll find a way around this somehow.

    Thank you so much and I really hope you can manage it. I'll provide images of what it's supposed to look like when working if requested

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