Rhindon's Forum Posts

  • (My apologies if the subject line is confusing. I couldn't figure out how to summarize the issue in a single line.)

    c3p file: https://drive.google.com/file/d/11FYrqAQ4IxS15PrvgXGqd9CD4LA9hCsp/view?usp=sharing

    THE GOAL

    My game focuses on being able to select three superpowers from an assortment of classic comic book-style powers. During actual gameplay, the Player can press the I, O, and P keys to swap between the three powers. Only one power at a time can be active. So far, the power swap system I have in place is working...mostly. But I'll get to the problem shortly.

    THE SETUP

    On the HUD, I have three instances of the same object - ActivePower_HUD - which has three instance variables: SlotNumber (num), Is_PowerActive_HUD (bool), and ActivePower_Name (str).

    SlotNumber - Indicates the object instance's index position on the screen and so it can be easily referenced within the event sheet.

    Is_PowerActive_HUD - To set the frame number of the active animation of that particular object instance. The 0 or 1 value of the boolean makes it easy to set the frame.

    ActivePower_Name - This value comes from the object instance's animation name. (Prehaps redundant, as I need only call the object's animation.) This way, ideally, I can minimize extra event blocks by not having multiple HUD objects per power.

    When the I, O, or P keys are pressed, it calls the function SetActivePower with three parameters:

    PassTo_ActivePowerSlot

    Set_Slot_Inactive_1

    Set_Slot_Inactive_2

    The first variable corresponds to the ActivePower_HUD object instance that is intended to be the new active power. The other two, naturally, are the inactive powers. These variables will only ever have the values 1, 2, or 3. (So, if the O key is pressed, then the value of 2 will be passed to PassTo_ActivePowerSlot because that's going to be the new active power. Whatever power was chosen second at the start of the game will be in the second power slot on the HUD of the game screen.)

    When the function is actually processing, it picks by comparison each instance of the ActivePower_HUD object. It then assigns the Hero object (the one the Player controls) the corresponding power associated with the ActivePower_HUD instance in question. (It also assigns the inactive powers to other variables associated with the Hero, but these do not come into play yet and are just me trying to think ahead...)

    Next, I originally tried to make this system work using function mapping (and I do believe it would have worked) but I couldn't figure out how mapping works so my theory and a much simpler implementation will have to be worried about later. When the active superpower value got passed to the Hero object from the ActivePower_HUD instance object, a series of event blocks checks to see what the value of Hero.ActiveSuperPower (str) is. It also confirms that the relevant boolean instance variable is false.

    Example: Active superpower is Flight.

    IF...

    -> Hero.ActiveSuperPower = "Flight"

    -> Hero.Athlete = false

    Then...

    -> (Do these actions, including setting the Hero.[boolean] to true.)

    This is meant to simply activate the powers and set the parameters of that power.

    After that, another set of event blocks checks to see if the Hero.[boolean], as related to the active superpower, is true. If it is true, it again confirms that the related string variable, Hero.ActiveSuperPower, is still the correct corresponding value. If all checks out, then the controls for that superpower work as indicated.

    However, when a superpower gets swapped out, then Hero.ActiveSuperPower gets updated but Hero.[boolean] is still true (momentarily). When the boolean is true but the superpower value is no longer that superpower, then the superpower is "deactivated" and the related boolean is set to false. Ultimately, this was the best way I could think of to turn the powers on and off without having superpower overlaps.

    Thank you for bearing with me...now to get to the problem.

    THE PROBLEM

    So far, I have only three working powers: Athlete, Flight, and Invisibility. Flight works fine, and swapping between powers is also working. And technically, Athlete and Invisibility also work (though the Hero doesn't actually go invisible...yet). The issue is that when I swap between Athlete and Invisibility, the associated behavior does not work. And both use the Platform behavior but with different property values for the behavior.

    So, I can switch between Flight and Athlete and Flight and Invisibility just fine. No problem. The issue is that when I swap between Athlete and Invisibility, the Platform behavior will get disabled when swapping from one power but for some reason does not get re-enabled when swapping to the other power.

    The odd thing is that I test this by adding breakpoints at event lines 22, 29, and 37 (Hero.ActiveSuperPower = "[power]") and it worked!! When a breakpoint was reached, I swapped between the two powers that both use the Platform behavior. And each time, the Platform behavior was enabled as it should be!

    Again, I apologize for the length of this help request, but I wanted to make sure everything was as clear as could be. I could use some help figuring out why this works with breakpoints but not without them.

  • R0J0hound - Thank you, as always!

    Finally getting some time to check this out.

    My main concern was how the Wheel object would "snap" to a different angle upon click or de-click. (Although, fine-tuning the actual turning behavior of the wheel in relationship to the X-drag factor of the Touch is also nice, but that's kind of a secondary issue presently.)

    I'm going to check out your examples now and get back to you if I have any other issues.

    You're a great help every time! GOD BLESS!

  • WHAT I AM TRYING TO DO

    On the mobile screen, I want to have a steering wheel object that the Player will touch and then drag along the X-axis, which will, in turn (heh heh..."turn"...okay, I'll stop), the Wheel. As you can see in the screenshot, I'm using Lerp and Unlerp to accomplish this.

    Regardless of where the initial Touch is at on the screen, dragging left or right from that point should rotate the Wheel accordingly. For the most part, this works...

    THE PROBLEM

    When I click on the Wheel, it "snaps" to an angle rather than remaining at the angle it was "at rest". Because I store the initial Touch.AbsoluteX value to an instance variable in the Wheel, and the rotation of the Wheel is based upon how far the Touch is dragged from that same initial X value, it doesn't make sense why the Wheel snaps to any other angle simply from an initial Touch.

    This problem is repeated upon Touch End. The Wheel does not Tween/rotate to the desired angle when I release the Touch. Instead, it snaps to a different angle.

    WHAT I NEED

    I'm hoping that along with a possible solution, someone might help me to better understand the Touch behavior because I do not use it very often at all. There are particulars I'm definitely not familiar with concerning Touch devices (that seems obvious to me). Or maybe it's just the way Construct 3 handles these things. I don't know.

    I will keep working at this and trying different things, but I would be grateful for some insight.

    Thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have a single instance of a tilemap object with all the road-themed tiles in place.

    From those tiles on the tilemap instance, I want to select only specific tiles and then randomly select one of those tiles.

    What would be an efficient way to do that?

    Tagged:

  • This is an issue I've been dealing with for years...ever since the C2 days.

    Across two laptops and using both the built-in touchpad and an external mouse (several different types), at least half of the time (lately, as much as 90%), when I click on an object while holding down CTRL and drag to make a copy of that object, upon release of the mouse button, the image editor invariably will open. I do not double-click.

    I have tried every variation I can think of to prevent this or figure out what's causing it. Such as...

    - Releasing CTRL at least a second before releasing the mouse button.

    - Releasing the mouse button before CTRL.

    - Lingering the mouse at the destination in the layout for a moment before releasing anything.

    I don't know how to replicate this outright other than to keep using the shortcut and maybe (but almost always) it will happen again.

    I could use some input/insight from someone who is more technically-minded than I am with C3 and/or hardware. Before I submit this as a bug, I wanted to get some feedback first.

  • R0J0hound Nothing in the file?? Odd. I set it so anyone with the link can view it.

    In any case, the example you just posted is basically the same setup as what I have as well.

    I tested something further...

    I opened the Instant Hit Laser example in the C3 example browser.

    Naturally, the use of Ray Cast intersection works...on the two Rock sprites. I added a new sprite but the laser object (via Ray Cast) doesn't detect the new sprite I added. It goes right through.

    But then I noticed something JUST NOW... SOLID BEHAVIOR!!!

    For some reason, Solid behavior is the key! I removed the Solid behavior from the Rock sprite objects in the example and the laser went straight through, just like my sprite that I added. I went back to my project and added Solid behavior to my Wall object and it worked!! The global variable I was testing with also changed to "1" to confirm the Ray Cast intersection.

    PROBLEM SOLVED!

    Again, thank you for your time in trying to help me sort through this!

    I'll keep on saying it every time: you are a blessing and I'm glad you're part of this community. I've learned a lot from you over the years.

  • R0J0hound I've tried it both with and without declaring an LOS obstacle.

    Just now, with the Ray Cast action set to cast line from (Arm.X, Arm.Y) to (Arm.ImagePointX, Arm.ImagePointY) after declaring the obstacle. It is still not registering a hit.

    https://drive.google.com/file/d/1Hc50kk934WHXPTTZ_twaW8lz76U1sj4W/view?usp=sharing

    This is the link to my current project if you want to have a look.

    Thank you for your help as always. :)

  • R0J0hound Correct. The Origin Point is at one end; the Image Point at the opposite end.

    I tried both of your suggestions and still nothing worked...

    Further, I disabled the collision check property of the Camera_Arm (thinking maybe that had an influence...it doesn't). At the suggestion of a friend, I have specified sets of events grouped together in different event sheets for organizational and optimization practices (he released BioGun recently and it's a HUGE project). The Camera system is in its own event sheet so I copied the event lines over to the main sheet for the layout just in case *that* was somehow an issue. Also...not an issue.

    I'm not sure if this is due to a lack of my understanding of how a Ray Cast is calculated and what exactly triggers a "hit" or if there's a bug...

  • R0J0hound So, here's where I'm at...

    (I tried to upload a pic to this reply, buuuut, there was an error.)

    NOTE: "Self" here refers to the Camera_Arm object that has the LOS behavior.

    Set global variable RayCastTest = 0

    [Empty event]

    [Action] --> Cast LOS Ray

    --> From ( Self.X , Self.Y ) to ( Self.X + cos(Self.ImagePointX(1)) * Self.Width , Self.Y + sin(Self.ImagePointY(1) * Self.Width )

    [If LOS ray is intersected] --> [Set RayCastTest variable to 1]

    Despite copying this setup straight from two C3 examples included with the editor, I'm still getting a false return on the intersection check.

    Maybe this isn't about the trig but about my understanding of how ray casting works...

    It's my understanding that if a ray is cast, it's true if there is ANY object that intersects with the ray...correct?

  • R0J0hound That's not a bad idea. I can see that working and probably having the same issues you just mentioned. I'll give that a shot and try to refine it if the cos( ) and sin( ) expressions don't work the way I want them to...they should, though, since there's an Example in the C3 start page that literally uses those math expressions.

  • mOOnpunk - Yeah, I should have clarified that better (I updated my post accordingly).

    They are just 2D sprites in the layout and then At Start Of Layout, I stack a series of other sprites at increments along the Z axis. So, yeah, not real 3D walls.

  • WHAT I'M TRYING TO DO

    The custom Camera System I'm trying to set up is to have the 3D Camera follow behind the Player and rotate around accordingly. The Camera will be set to the end of the Camera Arm (which, itself, will be attached to the Player). The Camera will be set to the Arm's image point at the far end.

    As the Arm will do the actual rotating - the Camera being "along for the ride" - to avoid having the Camera on the opposite side of the "3D Walls" (a series of 2D sprites stacked via Z Elevation) and thereby having the view obstructed, I want the width of the Arm to be dynamically reduced to keep the Camera within the boundaries of the Wall. This would mean the Camera is momentarily brought closer to the Player...but as the Player moves away from the Wall, the Arm will grow back to its maximum width and the Camera will likewise be farther from the Player.

    I want to use Ray Casting (Line of Sight behavior given to the Arm) to determine if the Arm is overlapping a Wall and automatically adjust the Width of the Arm so that it is not extending past the closest edge of the Wall to the Player. This would keep the Camera inside the immediate surrounding boundaries of the Player.

    GREEN TRIANGLE: Player

    BLUE ARROW: Player facing direction

    GREEN ARROW: Indicates Player rotation

    RED BOX: Camera Arm (origin point is at the right-most end, attached to the Player)

    ORANGE ARROW: Ray Cast

    The Ray Cast is meant to say, "This far to the Wall from the Player...the Arm should not be any longer than this value."

    PROBLEM

    Besides the fact that this isn't working and thus the need for this post asking for help?

    Right now, the Arm is not updating its width.

    I added a Global Variable to test if the Ray Cast intersection is returning a True value. ...it is not.

    From reading the C3 Manual, It is my understanding that using the action Cast LOS Ray from /origin/ to /target/ will return a True or False and can be used in conjunction with the condition LOS Ray Intersected.

    The problem I'm facing is that there doesn't seem to be a True value returned when I cast the Ray. I want to specify which Wall to cast to and yet nothing works. The Global Variable always remains its initial value of 0.

    This is the latest configuration of events I've tried (I've had it used as a dual condition with LOS Ray Intersected before moving it up to event line 3):

    I would be glad for some insight and help to better understand how Ray Cast works so I can utilize it properly.

    THANKS!

    EDIT: PROBLEM RESOLVED

    I discovered that objects that could potentially register as a "hit" or intersection alone the Ray Cast line must have a Solid behavior. So not just any object in the Layout will trigger a Ray Cast "hit".

    This was tested by opening the "Instant hit laser" C3 example (find it through the Start Page tab) where I added a basic sprite. The laser when right through my sprite but not through the Rock sprites included in the example. I noticed a major difference between my sprite and the Rocks - the Solid behavior. I disabled the Solid behavior on the Rocks and the laser when through them, just as it did with my sprite. I further tested this in my project and added the Solid behavior on the sprite I was testing an intersection on...and the thing worked! A "hit" was detected.

  • R0J0hound I believe I understand. Experimentation, indeed, is called for. But since this is for a game jam, I'm going to have to save that for another time. It's not a critical feature, thankfully. Thank you!

  • FURTHER INFO: The layer that the Flashlight object is on has "force own texture" checked and the Flashlight object, itself, is using the Destination Out blend option.

    This is the part that works fine.

    In order to make it so that the hidden objects on the floor stay hidden while the walls are visible, I'm trying to set it up so that the layer with "force own texture" is 75% opaque while trying to find the setting(s) that make it so the obstacle is invisible until it is overlapped with the Flashlight. It is that last part that I'm having trouble with.

    What layer do I put the obstacle on?

    What blend mode do I set it to? Or do I need to set another layer to a blend mode? Both?

    What other layers do I need to set to "force own texture"?

    I sort of understand "source" and "destination". My current understanding is that "source" is the object on top and usually the object with the blend mode active. "Destination" is the object below the "source" and sometimes on another layer.

  • dop2000 or R0J0hound - May I request either of your help, please?