?SOLVED?Checking Distance on Overlapping Pixels

For questions about using Classic.

Post » Mon Jan 16, 2012 1:31 pm

[QUOTE=Shindoh]If I check for 'Is Overlapping', then I expect it to be a continuous check and not a one time result. And perform actions according to "as long as overlapping". If I wanted them to be executed once I'd use the 'perform once' expression.
But this way it would be useless in a while loop, unless I used the System Condition.
In other words, if I applied actions to the Sprite Condition, it would make no difference if they are in a while loop or not, this way. It would behave the same.[/QUOTE]
I know what you mean, although we don't have exactly the same point of view. I wouldn't expect sprite's "is overlapping" to bahave as it does, but I wouldn't expect the system's one to behave as it does, either!
And here's why. CC is a tick-based system. Every tick is like a short period of stopping the process. You can do whatever you like within that tick, and everything gets computed, and the whole process will continue as soon as you are done. So one tick may use 10ms to get computed, another one may need 2 seconds. But I'd expect consistency, everything that's true at the beginning of a tick should be true throughout the tick. Of course that would render loops within a tick almost pointless, but one could rely on the status of a tick.

I suspect that "Blue Sprite overlaps Red Sprite" is only checking before entering the tick and then gets confused by continously asking for the state of that Blue Sprite while at the same time altering its position value. I come to this conclusion, because I can make it work, if I avoid using the overlap condition as a while-condition.

+ System: Always (every tick)
-> Sprite: Set position to MouseX, MouseY
-> System: Set global variable 'done' to 0

+ Sprite: Sprite overlaps Sprite2
-> System: Set global variable 'done' to 1

+ System: While
+ System: Is global variable 'done' Equal to 1
-> Sprite: Set X to.X - 1
++ Sprite: [negated] Sprite overlaps Sprite2
--> System: Set global variable 'done' to 0

Believe it or not, this one works. The only difference is that the while-condition is a test against a value of a global now, and that global will be altered in a sub-event that checks for overlapping, again. Confuses me.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Jan 16, 2012 4:30 pm

And believe it or not, overlapping at offset (0,0) works the same way as the system condition. I think it's some sort of inconsistency in the code for that condition.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Mon Jul 01, 2013 2:49 pm

hi
   i am new to construct 2 could any one please help in solving my problem. i have taken a car in which i have applied physics behaviour to it.when i clicked on that particular car that has to move to other end without stopping with continuous motion on to it and also if it is blocked or hit another object while moving it has to move.

       i have applied force,angle,position but it did not work could you please help me out in sloving this.

Thanks in advance.
B
4
Posts: 12
Reputation: 249

Post » Mon Jul 01, 2013 6:22 pm

Sorry @KPS I'm not too sure how to help in this situation.

However, this is the Construct Classic area, so you might find better help in the Construct 2 "How Do I?" section: https://www.scirra.com/forum/how-do-i_forum45.html

And if you can provide an example source file (.capx) of what you're trying to do then it'll be easier for others to help you out

"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Tue Jul 02, 2013 7:38 am

hi jayjay

        i have done some part of the game using construct 2. i have placed a box in path of car.Even if the car hits the object the car has to move with continuous motion with wheels rotating.

Here is the example which i have done

system -> on start of layout-> tier create physics revolute join ta image     point 1 to car
                               tier1 create physics revolute join ta image point 1 to car

mouse | on left button clicked on car -> tier apply physics force (800,0)at image point 1KPS2013-07-02 07:51:40
B
4
Posts: 12
Reputation: 249

Post » Tue Jul 02, 2013 4:06 pm

I like to redirect Construct 2 users to that section of the forums, but I think I understand a bit more of what you're doing, your car is made up of many small physics objects?

And if you don't want the car to move you might be able to get around this by setting its density to a really high number for all the parts of it (eg: 999)
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests