How can I destroy the objects as they come out of the screen

Get help using Construct 2

Post » Sun Nov 27, 2016 10:51 pm

Hi, my friends, I would like to see if you can help me with something. I'm creating a platform game in which the player always goes forward and can not go back. That is why I want it to be destroyed when an object is out of the view of the screen. So it does not consume memory in the collision check. Can someone tell me how?
B
13
S
4
G
1
Posts: 16
Reputation: 1,359

Post » Sun Nov 27, 2016 11:38 pm

Simply give it the behaviour destroy outside layout.

If your window is smaller than your layout and that doesn't work for you, do the following:
  • add a family with all the objects you want to be affected by this
  • add two conditions:
    - if [family] x is between 0 and Window.width (invert condition)
    - if [family] y is between 0 and Window.height (invert condition)
  • under those conditions, add: [family]: destroy
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Mon Nov 28, 2016 12:54 am

Ook, I'll try that thanks !!!
B
13
S
4
G
1
Posts: 16
Reputation: 1,359

Post » Mon Nov 28, 2016 1:04 am

I'll even have to try that @randomly

Right now, i have invisible sprite rectangles that stretch the length of the window, offset just a few pixels, on all four sides. I have an event/action: Sprite > On collision with (those boxes) Sprite > Destroy.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Mon Nov 28, 2016 2:18 am

@jeffige
@Cojoyo

I just realized that there is a possibility which is way easier:

conditions:
  • [family] Is on screen (invert condition)
  • Trigger once while true
  • event:
    • [family] Destroy
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Mon Nov 28, 2016 10:36 pm

Jjj, I'm already using that second option, it works very well. Thank you.
I want to test this because I notice that collision checking objects are always consuming memory, so I want to see the effect this can generate for reducing memory usage. It's that in the game I'm creating
When testing on the tablet runs at 30 frames which is very slow and I have tried everything and this does not improve, but I know that the highest consumption is always between objects and graphics mainly.
B
13
S
4
G
1
Posts: 16
Reputation: 1,359


Return to How do I....?

Who is online

Users browsing this forum: blue visionary and 24 guests