[Help] Automatically set angles based on instance variable value.

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • 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!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • 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?

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