MassimoF's Recent Forum Activity

  • Problem Description

    Line-of-sight behavior behaves differently from what stated in Official C2 Manual.

    In short: if you have a “Target” sprite in the LOS of your “Shooter” sprite (i.e. it is “within range, within the cone of view, and with no obstacles in the way of a straight line between the two objects”), and then you simply add the Solid behavior to the Target without changing anything else, the Target results no longer to be in Shooter’s LOS.

    Attach a Capx

    The attached capx tries to show a simple case in which this maybe a not negligible issue.

    https://www.dropbox.com/s/mkgx11qygtmgvs9/LOS%20bug.capx?dl=0

    Description of Capx

    The player's sprite (grey tank) must shoot at incoming enemy vehicles (green tanks & halftracks – only the tanks have Solid behavior). To aim at a given vehicle the player must turn its sprite towards it moving the mouse; the capx then checks if that vehicle is in Player’s LOS and therefore eligible as a target. If yes, the target itself is highlighted.

    Steps to Reproduce Bug

    • Step 1 Try to select every enemy vehicle as a target pointing the player’s tank towards it.

    Observed Result

    Only the halftracks are eligible as target (i.e. highlighted when aimed at); the tanks, despite the fact are exactly in the same visibility conditions than halftracks, are not.

    Expected Result

    Since the conditions to have a clear LOS between two sprites (Player and enemy) are fulfilled by all the enemy vehicles *, any vehicle should be eligible as a target * and highlighted when aimed at (i.e., any vehicle should be in player’s LOS).

    *: Exception: the halftrack behind the tank

    Affected Browsers

    • Chrome (v. 48.0.2564.116 m (64 bit)): YES
    • FireFox: don’t know
    • Internet Explorer (v. 11.0.9600): YES

    Operating System and Service Pack

    Windows 7 Pro, 64 bit – SP 1

    Construct 2 Version ID

    v.224, 64 bit

  • Hi, here is my question:

    a sprite with LOS behaviour (in its default config) has its LOS blocked by the first encountered "Solid" object, but (IMHO) a clear LOS to that object should be present (if my player is shooting to a column of Solid tanks, at least the first one should be reachable...)

    But, on the contrary, it appears such a blocking object is considered out of LOS by C2.

    EXAMPLE: try the C2 stock example "Line-of-Sight" (i.e. the one with Player, walls & pigs). Add the "Solid" behavior to the pigs, and no one of these will be longer in LOS, neither the nearest. Of course, if you change the parameter "Obstacles" of the behaviour from "Solids" to "Custom", all works fine.

    Does a simple workaround exist? thanks!

  • OMG...this plugin is absolutely *amazing* ... thx soooo much, Rex, this will spare me several headaches.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • already done, of course, and not only once ... but I don't struggle for a better fps value (40 fps on mobile are ok for my needs) but for a correct time computing on all devices...

  • Hi all,

    a question about time.

    My game adds, every tick, dt in a variable and shows its value in a Text object on

    screen (just for test purpose). Timescale = 1.

    On both my PCs, one running the game at about 40 fps and the other one at 60+ fps, the value showed

    is almost exactly the same of that on my wrist chronometer: I start game and chronometer at the

    same time, and when the chrono reaches, say, 60 seconds, on screen appears more or less

    the same value.

    But on a phone Motorola Moto G (Android 5.0.2, running at 40 fps, timescale = 1) things are

    different: when the chrono reaches 60, the value on screen is still at 55, and other 5 or 6

    more seconds are needed to reach 60. And the game runs just a bit, but visibly, slower

    (this is why I performed this test). Of course I do an extensive use of deltatime in my project,

    but in this case it is useless.

    Note: the PCs tests are performed in preview, the phone test via a build with Intel SDK (without Crosswalk).

    Probably I misunderstood something - but what? and if not... is a workaround possible? just to make

    my game running at the same speed on all devices.

    thanks in advance (also for the effort to read my english ) )

  • No, thx, is not necessary, I alreeady succeeded in figuring it out myself

    It's ok also f.ex. subtracting the Player_ship.Angle to the obtained value.

    Thanks again

  • Thank you for your help.

    Your capx would be ok, but it does not take into account the facing, continuously changing, of the player’s ship.

    Let's say your blu square is the player’s ship, pointing upwards as in my attachment (i.e. 270° according to the Construct 2 convention); if the green square is exactly on its right, your code returns an angle of 0°. Ok, but if the player changes his ship’s facing, this value must change accordingly. F. ex., rotating the ship of, say, 90° on the right, while the green square remains still, the code should now return an angle of =90°, as the green square is now exactly in front of the ship.

  • Hi all, a new-newbie question.

    I’m sketching a “naval battle” game - below you can see the player’s ship with hers four spotting quadrants.

    Cannot figure out a decent method to get the position (relatively to player’s ship actual facing), of a potential target in a given moment - i.e., in which quadrant a given enemy ship is. I wasn’t able to find anything useful in this section of the forum, in the manual or tutorials .

    The only method I can imagine is pinning four invisible images (pointing 45°, 135°, 225° and 315° with a 90° LOS each) to the player’s sprite, and check in which LOS the target is, but it’s quite rough... I suppose there is a simple & effective method but I cannot find it.

    Thx in advance

    Massimo

  • Ehm...it appears I miss completely the syntax of the expression

    Now it works perfectly.

    Thank you so much for your help.

    Massimo

  • Hi everyone,

    perfect noob here... in English language too (sorry!).

    My, very basic, question is: in a top-down game I have an AI Car (with "Car" behaviour, guided by events) pursuing other vehicles in a large arena (Car Wars style ). The Car may easily figure out if a target is in front of it by "LOS" behaviour; when the target exits the LOS cone (I keep it quite narrow), the Car knows it turned left or right. This is the point: left or right? how can the car to obtain this info? I tried the formula "angle(Car.x,target.x,Car.y,target.y)", supposing that when it returns 180 or less is a right turn and viceversa, but the returned values are useless (zero or -90) - probably I did not understand the correct use of that expression.

    Any suggestion for a quick way to know where the target is relatively to the AI Car? thx in advance!

    Massimo

  • Hi everyone, Massimo from Italy here. I was a chemist, then a would-be artist, musician etc. I like boardgames (the ones with one-ton rulebook, like ASL or SFB) and a couple of PC games. So curious about C2.

MassimoF's avatar

MassimoF

Member since 4 Dec, 2014

None one is following MassimoF yet!

Trophy Case

  • 9-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

13/44
How to earn trophies