John Cutter's Forum Posts

  • I thought this one would be easy. It's so straightforward I don't know why it's not working. The AI hasn't been helpful this time so I turn, once again, to the geniuses here in the forum!

    Just to get the basics of my one level Undo working I added:

    + Keyboard: On Space pressed

    -> System: Save game to slot "undo1"

    -> System: Create object fam_cards

    + Keyboard: On Z pressed

    + Keyboard: Ctrl is down

    -> System: Load game from slot "undo1"

    Why doesn't this work? I press space to create a sprite, then press CTRL+Z and the sprite is still there.

    Tagged:

  • I finally decided to snap single selected sprites directly to my grid. For multiple selected sprites, I now set an anchor pin on the lowest selected sprite, pin all selected cards to it, snap the anchor to the grid, and then unpin everything.

    At first, I was trying to do all of this in a single action, which wasn’t working. Adding small (0) waits seems to have fixed it, but it feels messy.

    Is there a better way to handle this in Construct 3, or is this standard practice?

  • Thanks, dop2000! I hadn't seen this tutorial!

  • I've been working on this problem for the last two days and I can't figure it out. Yesterday, I turned to the new Claude 3.7 LLM and it gave me some super helpful pseudocode that does everything perfectly... except my sprites don't align to the 32x32 grid in my level editor. (When I try to drag one sprite under another one, they are not left aligned.) I think this is due to sprite offsets from my pin anchor, but everything I've tried to do to fix this has failed.

    What the Code is Supposed to Do:

    - Allow me to select sprites using single click, or CTRL click

    (I have other events that do multi-select with a rectangle)

    - The sprites snap to my 32x32 grid while being dragged

    spr_card = my card sprite

    fam_cards = family with spr_card as only member (has selected variable, 1 = selected)

    spr_anchor = anchor for moving multiple cards

    (spr_card and spr_anchor have a center image point)

    My Code:

    ----+ System: Every tick

    -----> System: Set snapped_x to snap_enabled ? round(Mouse.X ÷ gridSize) × gridSize : Mouse.X

    -----> System: Set snapped_y to snap_enabled ? round(Mouse.Y ÷ gridSize) × gridSize : Mouse.Y

    -----> spr_anchor: Set position to (snapped_x, snapped_y)

    ----+ Mouse: On Left button Clicked on spr_card

    ----+ spr_card: Pick top instance

    --------+ Keyboard: Ctrl is down

    ---------> spr_card: Set selected to Self.selected = 0

    --------+ System: Else

    ------------+ spr_card: selected = 0

    -------------> fam_cards: Set selected to 0

    -------------> spr_card: Set selected to 1

    ------------+ fam_cards: selected = 1

    -------------> fam_cards: Pin_Edit Pin to spr_anchor (X: True, Y: True, angle: True, width: No, height: No, Z: False)

    ----+ Mouse: On Left button released

    -----> spr_card: Pin_Edit Unpin

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just a quick follow-up.

    We had company for a few days so I was only able to try dop2000's suggestion yesterday. It works perfectly! I noticed that this only adds "CoveredBY" and not "Covering" but after a little thought, and AI confirmation, it became clear that I don't need to keep track of which cards the current card is covering.

    I had worked on this problem for two days and got help from ChatGPT, Claude Sonnet, Deepseek and several other AIs. Many couldn't give me working code at all, but after a lot of iteration I had something that *almost* worked. It was about 24 events and I still hadn't added extra code to get rid of the trailing "," in every string.

    The solution from dop2000 was only FOUR events, and there's no trailing comma.

    NOTE: I noticed that the solution included some strange question marks, so I uploaded a screenshot to ChatGPT and asked for an explanation. It provided me with a thorough and very understandable description of ternary operators and how they work!

    Thanks again, dop2000!!

  • Wouldn’t it be simpler to just save the type and position of each card?

    I'm already saving the positions, angles, and instance variables for each card. I need to know covering relationships between all the cards as I plan to write a simulator that randomly "plays" each level a thousand times, just using the data. This will give me stats like "average cards remaining" that I can use to help me test my 200+ levels.

  • Thank you dop2000 and ROJOhound!!

    These are SO MUCH easier than the suggestions I was getting from ChatGPT. I spent two days iterating on this problem and it seems like the solution was pretty simple.

    Strangely, I asked ChatGPT to help me create a pretty complex interactive bezier feature for my editor, and this only took an hour or so!

    (I can add or remove cards on the fly, and they will space themselves, with the appropriate angles, along the curve. The three dark circles are handles and the cards adjust as I drag them around! Without the AI I wouldn't even have ATTEMPTED this feature.)

  • I'm working on a solitaire level editor. ChatGPT has been a TREMENDOUS help on this project but we're stuck on something that I thought would be fairly simple. I'm hoping one of you experts can help!

    What I'm Trying to Do:

    When I SAVE my layout I want to iterate through all the cards and, using zIndex, figure out which cards are Covering and which cards are CoveredBy the current card. These will then get saved in instance variables, like this:

    card_spr.Covering = "3, 5, 7" (this card is covering cards 3, 5, and 7)

    card_spr.CoveredBy = "" (this card isn't covered by any cards)

    ChatGPT suggested that I create 2 families with spr_card as the only member. fam_cards has all the instance variables. fam_cards2 is for the inner loop.

    This was working, but I stupidly used Construct 3's UID in my events. This doesn't work for SAVING and LOADING, so I created a new instance variable: fam_cards.CardID and I increment this every time I create a new sprite. (It gets saved with the level.)

    But if I put CardID in the sprite my families can't access it. And if I put it in fam_cards.CardID then I can't reach it with fam_cards2.CardID.

    Any suggestions? Is there an easier way to do this?

    Code Before I made my own "CardID"

    + System: For each fam_cards

    -> fam_cards: Set Covering to ""

    -> fam_cards: Set CoveredBy to ""

    ----+ System: For each fam_cards2

    --------+ fam_cards2: Is overlapping fam_cards

    ------------+ System: fam_cards2.ZIndex < fam_cards.ZIndex

    -------------> fam_cards: Set Covering to fam_cards.Covering & fam_cards2.UID & ","

    ------------+ System: Else

    -------------> fam_cards: Set CoveredBy to fam_cards.CoveredBy & fam_cards2.UID & ","

  • Thanks for the reply, envoys!

    I'm a longtime Construct user, but basically a 63 year old idiot. ;-) So I'm confused about what you mean by a "camera". I assume we are talking 2D and not 3D, right?

    Is your "camera" a block of code (or function) that controls the viewport?

  • Just a quick follow-up that might help someone else in the future...

    I solved this issue by rejiggering my array to put the zIndex values in the first column. Then, before pasting the cards, I do a sort. Unless I'm missing something, array sorts always happen on the first column only, hence the re-jiggering.

    This way the cards get created one-by-one with the appropriate z ordering.

  • For cutscenes and game events I ended up writing a camera with 23 active parameters - zoom and movement via tween or lerp with various curves, optional input blocking and types of hero tracking and forced scrolling. This saves a lot of time now.

    envoys: Can you describe your cutscene camera a little bit? The story I want to tell is pretty visual with lots of "sight gags". I can't afford to pay for all that animation so I'm thinking about using static comic panels and the timeline editor to scroll and zoom as needed. (Maybe with some limited animations here and there.)

  • Thanks for the reply, winkr7! I'm going to have to study up on templates. I've never used them and I have no idea what they even do!

    I wish I had some tips/tricks to share to return the favor. Hmmm. This might be one! On my last game I added two text files to my project and kept them on my UI. One was for bugs, and the other was a ToDo & Ideas list. It was nice to keep everything together and I never had to leave Construct!

  • I've used Construct products for many years, but only for small demos and single screen games. Now, I'm working on a solitaire game for Steam that will have several different game mechanics, hundreds of levels and over 50 animated dialogue and cutscenes.

    Any tips for working on large projects? (Things I might not have needed to worry about with my smaller games and demos...)

    Tagged:

  • No one got back to me, so I just went ahead and purchased the DARCSS theme. I haven't used it long, but it's definitely different from Construct's included "dark" theme. I like it so far!

    I have a few minor issues, but I love that it allows me to see more of my project at once! For example, I just opened a group and measured how much vertical space my events required:

    Default Theme: 716 pixels

    Dark Theme: 853 pixels

    DARCSS: 582 pixels

    This means I can see more of my "code" without having to scroll up and down!

    Dislikes So Far:

    - I'm sure I'll eventually get used to it, but some windows (like the animation editor) are really hard to distinguish from the background as they are nearly the same color.

    - This is minor but DARCSS uses red and green colored rectangles for anything that can be toggled true or false (i.e. whether a sprite is global or not). It's a neat feature, but now it's a bit harder for me to to change font or other colors as I used to just look for the colored rectangle. Now, there's a bunch of them!

  • I've been leveraging a range of AI tools to assist with my current project, and their impact has been transformative. Many of my prompts require multiple iterations, but the iterative process itself has proven invaluable for helping me come up with a solution and just helping me better understand my problem.

    In my experience, the quality of AI-generated results improves significantly when I provide detailed, context-specific information. This means being explicit about referencing sprite names and even pre-defined global variables. The more precise this input, the more relevant and accurate the output tends to be.

    Additionally, I’ve found it beneficial to break down requests into smaller, more focused tasks. I usually try to implement features myself and only turn to AI when I encounter roadblocks -- particularly those involving intricate algorithms, mathematical challenges, or logic that requires a perspective that is new to me.

    The AIs I've tried are especially effective when it comes to exploring different problem-solving strategies. Rather than seeking direct solutions, I often frame my queries around conceptual approaches, asking questions like, “I want to accomplish THIS -- what would be the most effective way to tackle this problem?” This not only yields practical advice but also helps me think more critically about my own design and development choices.