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.
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.
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.
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
- 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