Rhindon's Forum Posts

  • dop2000 - Thank you. I will try that and get back to you with a yay or nay.

  • SET UP

    In order to account for the possibility that my Character, "Buster", will collide with multiple instances of the Enemy at the same time, I want to isolate the closest Enemy in this rare occurrence. The reason for this is because Buster is going to attempt to "possess" the Enemy and so the possession loop is triggered. But he can only (attempt to) possess one Enemy at a time. So I need to make sure the right Enemy is isolated in a manner that makes sense to the player.

    PROBLEM

    The issue I'm having is that the same Enemy is picked when using Pick Nearest condition no matter how close or far away the Enemy is when two instances of Enemies are collided with at the same time.

    ATTEMPT TO SOLVE

    I have tried to isolate the Collision and Pick Nearest conditions per someone else's suggestion in Discord. However, I'm still getting the same problem. Previously, I had Pick Nearest in the same condition line as the Collision check. I don't think the order of the condition checks is the issue, because I need to pick all Enemies that are being collided with and then pick the closest one.

    Ultimately, I'm confused as to why this isn't working. Insight would be appreciated.

  • Excuse me while I gaze in dumbfounded awe at the lightbulb that just went on above my head.

    Touch ID VS Nth Touch.

    ...it suddenly dawns on me that these are, in fact, as you just said, two different things. I just assumed they were the same. That the Nth Touch is its ID. That would explain why I was having trouble.

    I honestly did take a look at several of the Touch examples before I even got to work but I couldn't find what I was looking for in the available examples - it's possible I didn't look enough or didn't know which one to look at. Anyway... I will keep that in mind when I later implement Touch in my project. Things are working now as I have them but I'm not done yet with my Touch controls...

    I'm quite certain now that you're correct about it being a bug in my events.

    Thanks for your time and patience!

  • R0J0hound

    I tried to isolate the problem further...

    I set it so that it checks if any Touch ends then set the Touch_ID value to -1 (I made the initial value of Touch_ID to be 0 in this test).

    This basically ignores the On Touch condition for now.

    And...it worked. So, my novice understanding of things leaves me with a couple of conclusions:

    1. On Nth Touch Ends is failing to register or recognize the value sent to it (via Touch_ID).

    2. It has something to do with the fact that the Nth Touch is being held (remains in touch for a time) before it later comes to an end and so On Nth Touch Ends spazzes.

    Shall I submit this as a bug? What do you suppose?

  • R0J0hound And that's what I thought I was doing.

    I disabled the "while in touch" line so that there's only "On Touch Start" and "One Touch End", calling on the TouchID value. Touch Start works... Touch End never registers.

  • R0J0hound

    Okay! That didn't take long. The specific issue you helped me with did work. But, new problem...and, seriously, I just don't get why this isn't working. I'm still a noob to the Touch-related matters of C3 (always have been since C2) but I thought this was straight-forward enough.

    Per the screenshot...

    LINE 3

    Check when a Touch has initiated and make sure it's on the left-side of the screen. Ensure the global variable Touch_ID is -1. This is to restrict movement controls to one side of the screen. (Controls on the right side need only register a tap...but that's for later.)

    If true, set the TouchXBase variable to the initial Touch.X([layer]) as this will determine how much to rotate the camera through dragging. Set Touch_ID to the Touch.TouchID value as this is the specific Touch ID value that needs to be constantly checked for while dragging is still true.

    (Get the Podium object's angle stored...but that's not important now.)

    LINE 4

    If Touch is active and it's on the left-side of the screen and that Touch ID value matches Touch_ID variable, then update the TouchDifference variable. The difference between Touch.X([layer]) and TouchXBase will be used to determine how much to rotate the Camera.

    LINE 5

    When the Touch of ID value Touch_ID comes to an end, then set Touch_ID to -1 so it's ready for the next control input from a Touch on the left-side of the screen.

    WHEW! I hope that all made sense.

    PROBLEM!!

    When I run it in debug, Touch_ID updates to a value of 1 and TouchXBase updates to whatever Touch.X([layer]) X value is. Everything works up to that point. What doesn't work are the events on Lines 4 and 5. TouchDifference doesn't update and it doesn't register when the Touch.TouchID ends.

    Upon testing the Touch object in debug, I did confirm that it registers an active/held touch (mouse click and hold) and that instance of a touch ends when I release the mouse button. So, something is getting lost in the mix starting at Line 4.

    I'll keep at it while I wait for your reply. Thanks again as always!

  • Instead of touch.x which grabs the coordinates from the bottom layer you can use touch.x("TouchInderface") to get it from the specific 2d layer.

    YUP! That did the trick! I completely forgot that you could do [object].X( [layer] ).

    NOW! Onward to my next conundrum!! (It'll be here sooner than I think, I'm sure!)

  • THE SETUP

    The 3D Camera is going to be set behind a central figure in the center of an arena. The Player will tap-hold and swipe left/right to rotate the central figure and thus the Camera behind it, giving a 3rd-person perspective.

    The 3D Camera is set to "Up Vector Z = 1".

    WHAT I'M TRYING TO DO

    When the Player holds a Touch on the screen (on the left side of the overall viewport), dragging X pixels left or right will rotate the 3D Camera smoothly a given number of angles. I believe Lerp( ) will be applied here. The idea being that for every X pixels that the Player drags their Touch along the X axis (relative to the viewport and not the layout), the central figure will rotate, too (the Camera with it via Pin). So, if one pixel to the left means rotating 10° clockwise, dragging Touch 10 pixels to the right means rotating 100° counter-clockwise (these numbers will obviously have to be adjusted).

    If needed, the Player removes their Touch, then Touches the screen again and drags to rotate the Camera.

    WHAT I HAVE SO FAR

    Hopefully this saves a LOT of writing and explains everything so far... I can clarify in the comments if need be.

    WHAT I'M HAVING TROUBLE WITH

    At the moment, I'm relatively having success with setting the variables and getting the results I want. Relatively...because I just realized that I'm getting Touch.X (or Touch.AbsoluteX) values according to the canvas. The 3D Camera, at start-up, is angled to the far-left of the layout. So, when I Touch the screen, the X values end up being updated as I drag Touch up and down (again, because of the angle of the Camera).

    What I want it to do is update the Touch X value as I drag across the screen, itself. Regardless of the facing angle of the Camera or visual orientation of the layout, I want the X value of the Touch according to the viewport.

    The TouchInterface layer is set to a 0%x0% parallax and 2D rendering. I believe that's the proper settings...I could be wrong.

    I am not sure what else to try at the moment.

    Thank you for your help.

  • WE HAVE A WINNER!

  • I think if you add a for each enemyspawnarea to event 157 it should fix it.

    The on timer trigger doesn’t seem to trigger for each instance individually. Instead all the instances that finished their timer in the last tick are picked in the trigger.

    Thank you, R0J0! And Merry Christmas to you and Dop, both!

    I'll give that a shot and let you know what comes of it.

  • Yeah, I always wondered if this is intentional or a bug. Most (if not all) of other triggered events in Construct trigger for each instance.

    I'm clearly not the expect here but I have to believe that's a bug because it doesn't make sense to have select cases where an event line that refers any instance that's True but other cases when the same set-up does not take each instance into account or it just quits once it encounters the first True instance. That gets very confusing when it's not clear when you have to apply For Each and that's been a problem I've had with Construct for years.

  • dop2000 - ALWAYS a pleasure to get feedback from you, Dop. :) I hope you're having a Merry pre-Christmas time!

    Thank you - after all these years of using C2/3, I don't know how I didn't realize that about Trigger Once. Eh, maybe I just forgot as I don't use it often.

    Now, curiously enough, I managed to redo my event sheet (even made it shorter by a bit) but the same problem occurred. There is no Trigger Once to worry about and I have "On Timer" behavior triggers instead... But the value for the TotalActiveEnemies global variable remains inaccurate to the number of Enemies that spawned.

  • UPDATE

    Problem resolved - see comments below.

    ZIP FILE OF GAME .c3p

    https://drive.google.com/file/d/166Uiht-XNNaHucbyLIDLzuXLReWCF5Y5/view?usp=sharing

    WHAT I'ME TRYING TO DO

    In my Enemy Spawn System, the EnemySpawnArea objects are set to spawn an Enemy (one of three types randomly) when the animation for the EnemySpawnArea object reaches a certain frame.

    At this point, the Enemy is spawned and the value of the global variable TotalActiveEnemies increases by 1.

    NOTE: I know that I can track all the Enemies by putting them into a Family and tracking the system count value, but I would like to have a variable I can manipulate if I need to.

    WHAT'S THE PROBLEM?

    When you open the Layout 1 layout, you'll see that I have 8 EnemySpawnArea objects in the center of the arena where all the action will take place (surrounding the green square that is the Spaceship_Base object).

    When the Wave starts, color-coded "sparkles" should emit from the spawn areas that are activated (this is controlled by a separate process and everything works fine there). I have confirmed that each spawn area will only spawn one Enemy type at a time so you should be able to confirm in the system menu in debug mode that there are X Enemies as you can see visually.

    But when you check the global variable TotalActiveEnemies, it will not match the actual count of Enemies in the layout despite being calculated at the same time an Enemy is spawned - on the same action line!

    REQUEST

    Goes without saying - I need help to understand what's going on and what my oversight is so I can fix this (or if you have a quick-and-obvious-except-to-me solution!).

    I will keep working on this, myself, until I figure it out or someone provides a viable solution.

    Thank you for your time!

  • alextro - Whatever tests you were running, I thank you. I think I got it figured out now. For one, definitely "programmer error". I was forgetting to add a "+180" to the "set angle" actions which didn't help orientation.

    It also seems the order of the actions (setting the angle before the position) seems to have made a difference. Tis odd.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Usually you don't need for each for object container. Instead set the action directly to respective other object container.

    Normally, I would agree and have thought the same thing. But I've found that that doesn't always seem to be the case. I've had a hard time discerning when I do and don't need to specify literally for each container instance.

    Sadly, the problem persists. The second container group (the one on the right) doesn't all line up correctly.