robit_studios's Recent Forum Activity

  • I'm having trouble working out the math for my 2d asteroids-style shooter. In particular when the player is firing a projectile from an angle different than their current angle of movement. This image will hopefully describe the issue clearly:

    <img src="https://lh6.googleusercontent.com/-Qqh-EwBXasU/T1vldGGu_HI/AAAAAAAAAec/yJ3AZ-RNcik/s720/angle_bullet_question.png" border="0" />

    The actual ship is using Physics for it's movement.

    The player's speed is determined using this formula:

    sqrt(player_ship.Physics.VelocityX ^ 2 + player_ship.Physics.VelocityY ^ 2)

  • Thank you for the help, everyone. This was very informative.

    Yann, I ultimately found your execution to be the most useful for my situation. Thank you so much for the time you put into that example project. The visual element really helped me to understand what was going on.

    My game is coming along very nicely, so far, thanks to all the helpful people on this forum. I love you all!

  • I made a little example capx that shows what I'm trying to accomplish.

    http://dl.dropbox.com/u/28484936/pick_closest_problem.capx

    The ship that is controlled by the mouse is a part of a family called "Family Enemy Ships". There are two types of ships in this family. I want to be able to set an instance variable for the mouse-controlled ship to which ever object from that family that it is closest to. Currently it always picks itself as being the closest.

    Hope this helps explain my situation.

    Thanks, Kyatric!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have an enemy ship sprite and I want to set one of it's instance variables to be the closest enemy ship that isn't itself. If I use the "Pick Nearest to" condition it will always pick itself, which doesn't help me.

    Any ideas on the easiest way to do this?

    Thanks.

  • Ashley,

    Brilliant! You solved my issue! I had to adjust it a little bit to account for the rotation of the "Player".

    So, my code looks like this:

    Is 30 degrees within Player.Angle-angle(Player.X, Player.Y, Target.X, Target.Y)

    and

    Is clockwise of Player.Angle-angle(Player.X, Player.Y, Target.X, Target.Y)

    Once I did that, it works like a charm. I updated my capx that I was using as an example. I'll leave it up as it will hopefully help someone else who has this same question.

    http://dl.dropbox.com/u/28484936/within_angle_test.capx

    Thanks again!

  • I didn't think those conditions could test a sprite's position within another sprite's angle.

    Don't they just compare the angles between two sprites?

    If there's a way to use them to know another object's position, I'm missing how to do it.

    Edit: Ah, I see my wording was a little misleading in my last post. I edited it to be a little clearer.

  • Yann,

    Thanks. Your example is great (although, I'm not sure I am able to grasp how it works completely). But, I implemented it into my engine but I don't think it's going to work.

    What I really need to do is simply be able to test whether an object's position falls within a certain angle of the front of the ship and whether it's on the right or left side of that ship.

    I updated this Capx to show what I'm trying to accomplish. As you'll see it works perfectly as long as the "ship" is at it's default rotation. As soon as you rotate the ship I cannot figure out how to test position of the other object.

    dl.dropbox.com/u/28484936/rotate_issue.capx

    KeePee,

    I see how your idea works but I want to try to avoid doing something like that if I can. Thanks, though!

  • I've been struggling with this issue for awhile and I know there must be an easy answer but I can't come up with it.

    I'm making a top-down space shooter enemy AI. The enemy ship can rotate in any direction. I want to be able to test whether a certain object is within a range of angles relative to the rotation of the ship.

    For example if an obstacle is within 0 to 30 degrees (of the front of the ship) I can make the ship turn left (to avoid it) and if there's an obstacle within 0 to -30 degrees I can make the ship turn right.

    Using the Angle expression doesn't work because it doesn't account for the rotation of the ship.

    And the AngleDiff expression doesn't work because it provides an absolute value and I can't tell whether the object is to the left or right of the ship.

    Here's a simple capx that I hope will demonstrate what I'm trying to accomplish.

    dl.dropbox.com/u/28484936/rotate_issue.capx

    Thanks for the help!

  • Sorry, it looks like this topic has been discussed in previous threads... Guess I didn't look hard enough.

    http://www.scirra.com/forum/ignore-collision-between-physical-objets_topic48028_page2.html

    http://www.scirra.com/forum/disable-collision-for-physics-objects_topic47785.html?KW=

    It looks like the only way to do it for now is by using multiple layers. This might not work for the project I'm working on but I'll give it a try.

  • Hi all,

    I've just started playing with Construct 2 (after being a MMF2 user for a long time) and I'm loving it. In particular, the physics.

    There's one issue I've tried to resolve but been unable to. Is there a way for a particular physics object to completely ignore collisions from another object.

    For example: I have two balls at the top of a hill and a wall at the bottom of the hill. I want ball 1 to roll down the hill and bounce off the wall. BUT, I want ball 2 to roll down the hill and PASS THROUGH the wall.

    Is this possible?

    Thanks!

robit_studios's avatar

robit_studios

Early Adopter

Member since 17 Jan, 2012

Twitter
robit_studios has 1 followers

Connect with robit_studios

Trophy Case

  • 12-Year Club
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies