Destroy when X

0 favourites
  • 6 posts
From the Asset Store
Paint to prevent ball from falling and destroy all blocks!
  • This is more of a game logic / event logic question, bear with me please :)

    Window is 640x480

    I have a layout, it has 1000000 width, 480 height, and there is a bullet flying through from left to right, screen is set to every tick scroll to bullet. You control the bullet up/down.

    Every tick on random(10)<2 I create a target on Y random(480), X = scrollx+640 (on the right, off the screen, so it appears in a second and goes from right to left, so that you can hit it with your bullet)

    easy enough, the problem starts after a few whiles, because of the targets you didn't hit stay to the left of view, right? best thing to do is destroy them, if they are on the left side of view. so, I did and this is crucial:

    target: compare X < scrollX - 640

    it should work right? well guess what, it doesn't :) is there something with my brain or is it a huge bug in construct?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • dl.dropbox.com/u/1378330/BulletDestroyEg.capx

    Is that what you are trying to do? Works for me. It is usually a big help when you post capx's when asking a question like this.

  • well my capx is nearly finished game, so please do understand why I didn't post it. just when testing yesterday I noticed a huge slowdown which after investigation lead me to not destroying objects when left of layout.

    also wow, now I just have to find out where is the problem on my side as it clearly works for you :) thanks. it seems in my project it destroys some of the targets, and leaves some there, as the count sometimes drops, but the general number constantly rises :/

  • ok, got it, I am an idiot. thanks cow_trix :)

  • Just for future reference, ranma, what was the issue?

  • I was creating bullets at scrollx + bullet.x for some reason, probably drunk coding :) , so it was created way off to the right. my mistake.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)