Negative "on-Screen" Not working

Bugs will be moved here once resolved.

Post » Sat Feb 16, 2013 11:13 am

Link to .capx file (required!):
http://dl.dropbox.com/u/116137178/Bugs/Construct2/BulletNotFiring.capx

Steps to reproduce:
Just look at the events for mouse fire. According to the logic a bullet should fire when:

1, The mouse button is held
2, There isn't one on the screen already (inverted on-screen logic)

But nothing fires.

ramones came up with an alternate method using an "else" which works and I'm using for now, see:
http://www.scirra.com/forum/topic63526.html

I suspect negative logic for "on-screen" isn't working as intended.

Observed result:
No bullets are fired.

Expected result:
Mouse fires bullets, only one can be on screen at a time, thus fire rate is quick for close targets, slow for far targets.

Browsers affected:
Chrome: yes
Firefox: yes

Operating system & service pack:
Win7 64bit SP1

Construct 2 version:
119 64bit
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Sat Feb 16, 2013 3:40 pm

The way the engine works, a condition is always false, regardless of the state of invert, if there are no instances of that object which exist. In other words an event will not run if no instances met the condition. I would prefer not to change this, because "is on-screen" or "is off-screen" simply makes no sense to ask if there are no instances that exist.

Rather than change how the engine works, the workaround is simple: just replace 'is not onscreen' with 'Bullet.Count = 0', and destroy any bullets that are not onscreen.

Closing as won't fix.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Sun Feb 17, 2013 12:20 am

Thanks for the reply. :)

I do understand you wouldn't want to make any engine changes for such a minor case. Have to make similar decisions myself all the time.

If it will never return true / never do anything, would it be better to disallow us from setting it to inverted? Otherwise it gives the illusion that something is broken; it isn't doing what I tell it to do.

Also just out of interest, could you not put in the very code you suggested as part of the negative check?

NOT On-Screen

Instance.count = 0?
Return True
else
On-screen = False?
     Return True
Endif
Endif

Return False

B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Thu Jan 21, 2016 6:55 am

@Ashley This is a good decision to not confuse users. If invert on on-screen doesn't work, it shouldn't be doable at all.
B
32
S
4
G
1
Posts: 264
Reputation: 2,422

Post » Thu Nov 10, 2016 11:43 pm

Agreed with Dam, took me a solid 30 minutes to figure out that it just doesn't work, please take out the ability to invert 'Is on screen'.
B
21
S
9
G
1
Posts: 148
Reputation: 2,423

Post » Fri Nov 11, 2016 4:41 am

Changing such basic engine logic would "kill" many existing projects.
B
20
S
9
G
4
Posts: 220
Reputation: 4,555

Post » Tue Nov 29, 2016 5:29 am

mercuryus wrote:Changing such basic engine logic would "kill" many existing projects.


Not really, adding an invert option wouldn't kill anything since everyone uses Else anyway. It'd just give everyone the option, nothing would be 'killed'. You can use Else as an invert for anything, it's just a less efficient way. At least I think anyway.

EDIT: I derped, forgot we were talking about taking OUT the invert option for on-screen. That wouldn't kill anything lmao, it'd get rid of a lot of confusion for sure! At least give us a prompt when inverting on-screen saying 'This ain't gonna work bud'
B
21
S
9
G
1
Posts: 148
Reputation: 2,423


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests