Siegr's Forum Posts

  • 11 posts
  • In that case you simply take the difference in angle between the origin object and the target object, (assuming they all used the same origin angle and are rotated after), and add that to your pointer object's angle.

    You'll need some way to pick the origin and target surface to be able to get the angle expressions from them. First thing that comes to mind is to use a invisible helper sprite on overlap to get the right surfaces to get numbers from, but there are probably a few other ways to go about this as well.

    Thank you again, Oosy. To be honest, I kinda get what you mean, but just "kinda" hahaha. Not your fault though!

    If possible, I would really appreciate if you could simulate/exemplify how it would work with numbers. Anyway, I'll take a look at some expressions and see how I could achieve this. I confess I'm pretty lame at Math at the moment.

    Regarding targeting, I thought "Has Line of Sight of X" would to the trick when it comes to getting target surface and "Is overlapping at offset" would cover origin surface, but...I don't know, I'm messing up somewhere! Gonna mess around a little bit more tonight.

    Plus, when you say "origin object" and "target object" in the first sentence, what objects are you referring to?

  • In the event that you wanted the new angle to be a reflection off of the target platform surface (like a ball ricocheting off a wall on a pool table), which is what I understand from your written description, you'll want to do the following:

    Man, I confess I mess up hard when trying to explain this xD

    I don't think it has something to do with reflection. Dop2000 already mentioned Reflection on another topic I made, but I don't think it does the trick in this case, since I'll have many different objects to land on in many different orientations. Reflection would retrieve a different angle based on how the ray collides. What I want to achieve is the same angle everytime I jump.

    My fourth try trying to explain this, here I go xD

    What I want to achieve is:

    Let's say I'm on a wall right side (right edge). I want to jump off this wall towards another area and obj_PlayerPointer angle is, at this moment, 45 degrees, pointing Southeast - as Construct angle 0 is East. The platform I'm pointing to and going to land afterwards is a floor - going to land on it's top edge.

    Then, as soon as I press Space Bar and jump, I want that obj_PlayerPointer get it's angle set to a new value, and this value being a value that results on the same angle difference obj_PlayerPointer had in relation to the previous edge I was at, the edge I jumped from.

    And I want it to always do it, every time the player jumps!

    Here is another drawing: prntscr.com/r97wxx

    The angle doesn't need to be 45. I just want obj_PlayerPointer to maintain the angle - the one used on the previous jump - for the next jump, no matter what angle was used.

  • What are you trying to do?

    Works fine as written.

    Thanks for your reply, oosyrag.

    I want to, when jumping towards the next platform, detect the landing zone orientation - If it's a vertical or an horizontal edge. Then, when landing on the next edge, I want obj_PlayerPointer to have the same angle it had in relation to the previous edge jumped from, and so on. Always replicating the same angle from the previous jump.

    See this image, please:

    drive.google.com/file/d/1yfQMKTkokXxfaw_reBbGD6cW8oyYmPP-/view

    I used 45 degrees as an example, but I want it to work with any angle and with any edge orientation.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is something weird going on. As soon as I preview the Layout, some events do not trigger even though I know the conditions are being matched. Then, some time later and after jumping a few times, it starts working normally.

    I'm using "Object Has Line of Sight of another Object", but...for some reason it doesn't work.

    Here is link of the file:

    drive.google.com/file/d/1h5dOkxy9Zl3sSgn95PnwoeiZ1vB14uhC/view

    Here is where I'm struggling with:

    prntscr.com/r8lamr

  • Those are the events you need, player has line of sight of floor, it picks the instance of floor that is true. Then as a sub event you can say if floor.var = X then do actions, it uses the floor that was picked earlier and therefore its instance variable.

    Hi, Plinkie! Thanks for your reply and sorry for my late reply. It was Carnaval in Brazil...I confess I went partying hehe.

    I've tried what you said, but it didn't work D:

    There is something weird going on. As soon as I preview the Layout, some events do not trigger even though I know the conditions are being matched.

    I'm using "Object Has Line of Sight of another Object", but...for some reason it doesn't work. Would you take a look?

    Plus I changed some stuff...instead of depending on instance variable values, I created a new object for Vertical Floors (obj_FloorVert) and the old obj_Floor now refers to Horizontal Floors, now called obj_FloorHoriz

    Here is link of the file:

    drive.google.com/file/d/1h5dOkxy9Zl3sSgn95PnwoeiZ1vB14uhC/view

    Here is where I'm struggling with:

    prntscr.com/r8lamr

  • ...and then use it's value in a comparison.

    I can't provide a file now, but bear with me and you might get what I want to achieve. I want to retrieve the value of the instance variable on obj_Floor

    - obj_Player has Line of Sight of obj_Floor > Pick obj_Floor.Orientation value

    - If obj_Floor.Orientation (of that specific instance) is "X", then do

    blablabla.

    But I want "Orientation" value of THAT specific instance of obj_Floor that is in Line of Sight of obj_Player at that moment.

  • I don't fully understand the issue, but I think you need to use Line of Sight behavior with ray casting, instead of the obj_PlayerDestinyFinder object. Cast a ray, use Player.LineOfSight.ReflectionAngle expression, maybe that will be what you are looking for.

    See these two templates:

    https://editor.construct.net/#open=instant-hit-laser

    https://editor.construct.net/#open=raycast-reflections

    That's some interesting stuff you pointed, man. Took a look and was messing around with it just now. Buuut I'm not sure if this can help me achieve what I want. It definitely has something to do with angles, but I don't think reflection will do it.

    Regarding Line of Sight: I think this will perfectly replace obj_PlayerDestinyFinder, thanks for that!

    My main issue now is to find a way to pick/retrieve/read/return the value of the instance variable "Orientation" of obj_Floor when that's tracked by the LoS. If I manage to somehow point it's value in a condition, I'll be able to properly set the next angle of obj_PlayerPointer when jumping!

    Any ideas?

  • Hi again! This is my second post, here I go.

    File

    drive.google.com/file/d/1h5dOkxy9Zl3sSgn95PnwoeiZ1vB14uhC/view

    Commands: A key, D key and Space bar key.

    Reference

    I'm inspiring myself on Dandara jump mechanics:

    youtu.be/POXlm2t6zZA

    My intent

    Right now my main issue is the Pointer's angle. I want obj_PlayerPointer to have it's angle automatically set to an angle that has the same angle difference to the current landing area it had in the previous landing area. Plus I want to happen as soon as obj_PlayerMover jumps (instantaneously, if possible)

    Illustrative image

    drive.google.com/file/d/1yfQMKTkokXxfaw_reBbGD6cW8oyYmPP-/view

    I managed to get it to work as the intended way when landing on VERTICAL platforms, but couldn't do it when landing on HORIZONTALS OR DIAGONALS

    How I did it so far

    I created an obj_PlayerDestinyFinder that has bullet behavior enabled and set it to spawn when pressing Space Bar (along with jumping with obj_PlayerMover) and, whenever it collides with any obj_Floor instance, set angle of obj_PlayerPointer based on an specific formula (see in file).

    As I said, the formula works as intended when landing on Vertical platforms, but not when landing on Horizonals or Diagonals...

    I created an instance variable on obj_Floor and created different conditions to set it to "Horizontal", "Vertical" and "Diagonal" based on the angle of each particular instance...but I don't know how to "read"/"return" this instance value.

    What I'm aiming to try next, but don't know how to do it in Construct!

    When thinking about this, I thought that something similar would be the solution to the way I'm tackling it:

    - If obj_PlayerDestinyFinder collides with an instance of obj_Floor

    - Check instance variable of the instance of obj_Floor which obj_PlayerDestinyFinder collided with.

    - If it's "Vertical" > set angle using "Formula A"

    - If it's "Horizontal" > set angle using "Formula B"

    - If it's "Diagonal" > set angle using "Formula C"

    PS

    I've been trying to accomplish this during the last week, with no success. Got a little burned out, but I'm still up on my feet!

  • Turned out bullet stepping is not triggered frequently enough for large objects. Also, you had a different sprite for collision detection, so it was useless anyway.

    I fixed your project, see this file:

    https://www.dropbox.com/s/uuf0b4vc8byrwbu/0Grav%203%201.1_dop.c3p?dl=0

    Maaaan! You really did haha! Thank you for your attention. Plus, you presented some cool tools that I didn't know of. Been messing around with the file these days and I can feel it flowing way better!

    Thank you so much, Dop!

  • Not sure why you need both Platform and Bullet behaviors, remove Platform if it's not used.

    Bullet at this speed will almost never stop exactly at the edge of the floor sprite. It travels ~20 pixels per tick, that's why it often digs into the floor. You can enable stepping in Bullet behavior and check for overlapping with the floor in "On step" event, it may work better.

    Also, to prevent jumping through the floor sprite, you can enable "Bounce off solids" or check that obj_PlayerPointer is not overlapping the wall when Space key is pressed.

    Regarding having Platform + Bullet: at some point I got to believe Platform would influence collisions. I probably got confused, because I tested it without Platform behavior and I'm having the same results, then I'm letting it go.

    Regarding Bullet Pixels traveled per Tick: Man, it would've taken me so much time to figure this out! So clever of you!

    Regarding Stepping and "On Step" Event: I checked Step on Bullet behavior at obj_PlayerMover, but I'm confused on how to use "On Step" event. I did some stuff but I'm not sure I did it right. Anyway, I'm testing and having the same results :(

    Here is the new C3P file (0Grav 3 1.1):

    drive.google.com/file/d/1u-wdztNvfZm4rVVC9SsmNIPJJtJtD2wv/view

    Here is a .jpg of it's current Event Sheet:

    drive.google.com/file/d/1zHdxiGAou1vKFZrsNOLeUcagbGxELFHs/view

    Regarding jumping through the floor: That gave me some ideas on how to prevent this issue! I'm definitely gonna try that, but tweak here and there mixed with some stuff that just came to my mind!

    Anyway, thanks for your help and attention, Dop!

  • Help!

    Hi there! It's my first post in this forum. Hope I'm doing it right!

    OBS: I posted this same post in section "General Discussions", but realized it was at the wrong place. Gonna delete the previous one an maintain only this one here. I'm sorry for the mess!

    I have an issue related to collision. I'll adress it further.

    MY INTENT

    I wanted to recreate something similar do the main movement mechanic presented in the game Dandara (https://youtu.be/iWOrGvzUmZE?t=667 - already at the right time).

    First Try

    My first try went something like this: C3P File - drive.google.com/file/d/1ykUx-W_mu7tQ8bkVb5f6hzI-gFj3LcOx/view

    File Name: 0Grav 2

    Commands: A key, D key and Space key.

    THE FIRST PROBLEM

    It does what I want, but, since the obj_PlayerMover is, at the same time, the object responsible for player movement and for collision checking, when it rotates, the spr_Player - soon to contain the animations - will be in a different distance from the wall depending obj_PlayerMover orientation.

    Notice that obj_PlayerMover perfectly detects and collides with obj_Floor, which is amazing, and I presumed it would stay like that but...

    SECOND TRY

    My second try went something like this: C3P File - drive.google.com/file/d/1SkmXohduHqEyM7QCRaGVNUYBdBJJp4j-/view

    File Name: 0Grav 3

    Commands: A key, D key and Space key.

    THE SECOND PROBLEM

    In my second try I used 2 sprite objects - 1 responsible for collision (obj_PlayerCollider) and 1 responsible for player movement (obj_PlayerMover)

    obj_PlayerMover behaves essentially like in First Try, but obj_PlayerCollider has some issues when colliding with obj_Floor:

    It goes "in" obj_Floor...kinda digs itself in, and the amount that goes in varies each time I jump.

    Plus, after landing anywhere, if I point inwards obj_Floor and jump, it will just pierce through obj_Floor, not really detecting it's edges. How come this wasn't the case in First Try? If you try this in First Try file (0Grav 2), you will see it's not possible at all. I expected collision to work in Second Try (0Grav 3 file) the same way it did in First Try(0Grav 2 file).

    Thanks to all replies in advance.

    PS: I'm a Construct and general programming newbie.

  • 11 posts