Or statement is boned (a rant)

Discussion and feedback on Construct 2

Post » Thu Jun 23, 2016 6:39 pm

Callan S wrote:
humanescape wrote:
Callan S wrote:But in a regular IF statement I can test if catsprite is less than 500 x position and if it ISN'T I can still use ELSE to affect that catsprite. I'm not stuck being unable to affect it because it failed the first IF statement. But in an OR statement, if the object fails the OR statment I can't affect the object??

I mean there's a difference between the intent of
'Hey, check if catsprite.x<500 OR tacos>0 - if either, change THAT PARTICULAR catsprite!'
and
'Hey, check if catsprite.x<500 OR tacos>0 - if either, change the catsprite on the screen. The ONE catsprite that is there! One might even say change ANY OLD catsprite, though that's a bit odd to say when there is only one pre existing catsprite! But this is all to say I am not aiming at a particular catsprite, just any old one that is around. It doesn't matter if it's <500!''



You are missing one key aspect. There could be multiple catsprite. If it worked as you suggested, many games would be so hard to code. Just because you know there is one, does not change there is the possibility of multiple.


Yeah, but think of what the filtering is doing.

Functional filtering is if I'm trying to find all the catsprites whos X>50 and X<500. That's valid filtering.

Now why would we treat a test of catsprite.x<500 OR global.pizza>0, with catsprite failing, as filtering out out being able to affect catsprite AT ALL!? I mean this cat wants some pizza, he's not into cheeezburga, he wants pizza added to him! But when he's not <500, even though there is pizza, we can't give him anything?

Such a filter basically turns the OR into an AND statement - if catsprite.X<500 AND global.pizza>0 then the cat can have it's pizza value increased.

In fact all filtering seems to be an AND statement. Which really has no place in an OR statement.



I guess I just view sprites differently. You cannot really or something easily that can have multiple instances...that is not how an or should be used (in my opinion atleast).
B
45
S
18
G
8
Posts: 509
Reputation: 8,513

Post » Thu Jun 23, 2016 6:48 pm

Are you up for a test ? You write an event sheet for 100 sprites. (Will take you like 105 events) I rewrite the code and reduce it to 4 events, using instances and filtering the instances. Up to it ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Jun 23, 2016 7:27 pm

If you need to change all instances regardless of which instances get picked or don't get picked, you can add a Pick All after the Or condition in a sub-event.
I've been confused like you regarding how Or events work, but it is manageable once you understand them.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395

Post » Thu Jun 23, 2016 8:04 pm

99Instances2Go wrote:Are you up for a test ? You write an event sheet for 100 sprites. (Will take you like 105 events) I rewrite the code and reduce it to 4 events, using instances and filtering the instances. Up to it ?


Not sure who you are referring too, or what you are actually going on about.
B
45
S
18
G
8
Posts: 509
Reputation: 8,513

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: Tokinsom, Yahoo [Bot] and 19 guests