Puck's Recent Forum Activity

  • Thanks Potato, that works how I wanted it to, good stuff! I don't quite understand 100% what's going on in your one as I haven't used instance variables before, but I'll figure it out. Thanks again.

  • I'm trying to make a system where objects that are not near the player are not created until they're needed - my game has a very small visible area around the player, so until enemies are right on top of him they don't need to have lots of extra sprites that are slowing the game down.

    The idea I had was to have a Culling sprite around the player, and when it touched an enemy it spawned all the extras (i.e. a shadow), but at the moment it's spawning one shadow per tick, even though I have a "Trigger Once" condition (sometimes? it seems very flaky).

    You can see the problem here.

    Move with the arrow keys and try overlapping the pink "Culler" over the HTML5 icons, see the Shadow count skyrocket even though there's a Trigger Once condition.

    and here's the Capx.

    That's not even mentioning trying to delete an object when it's outside of the Culling sprite, which seems to be even more flaky. Am I approaching this problem the wrong way?

    Thanks.

    EDIT: The reason I ask is because I'm struggling to maintain a decent framerate in the game I'm building, so I need to find all the little ways to make it run as fast as possible. Perhaps I'm trying to do too much with C2, not sure yet. Here's what I have so far: Shadow test for zombie game. I'm getting about 50 fps in IE9 until a flare goes off, then it halves.

  • Thanks Kyatric, that clear's up a lot.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Wow that's so simple it hurts. Thanks Danijerry!

    EDIT:

    Oops, spoke too soon. It keeps creating guns and helmets every tick which kills the frame rate. I tried putting a "Trigger once while true" to no avail (which never seems to work, so perhaps I'm using it wrong". The "For Each" event's description is "The actions will repeat once for each instance of the object", so I'm not sure why it's spawning them continuously.

    CAPX - http://dl.dropbox.com/u/5478701/Shadowtest/instancepinninghelp2.capx

    EDIT 2:

    Okay I figured it out. Instead of replacing the "On start of Layout" with the "for Each", I made the "for Each" a subevent.

    CAPX - http://dl.dropbox.com/u/5478701/Shadowtest/instancepinninghelp3.capx

  • I have manually placed 5 Enemies on the layout. At the start of the layout I want each enemy to spawn a Gun and a Helmet, and have that Gun and Helmet be pinned to the specific Enemy that spawned it. At the moment each Gun and Helmet gets pinned to the first Enemy instance rather than the one that spawned it.

    Here's a capx I made showing my problem (and I assume also showing my lack of understanding on C2 basics):

    http://dl.dropbox.com/u/5478701/Shadowtest/instancepinninghelp.capx

    Thanks if anybody can point me in the right direction!

    PS: I've had no problems getting sprites to pin to their creation instances during other events, such as "On Mouse Click" spawn Enemy->Enemy spawn gun->Pin Gun to Enemy. But it doesn't seem to work for "On start of Layout". I've tried with other Events (like an overlapping invisible sprite, or Compare Time) but even with "Trigger Once if true" at the end of the event it just constantly spawns new sprites every tick... which is a completely different problem I'm having, and which is why I want to use the "On start of Layout" for the gun/helmet spawning+pinning.

  • Hi Everybody,

    Just started getting into C2 and I'm really enjoying how user friendly it is.

    I made a quick test of a 2d lighting solution.

    <img src="http://dl.dropbox.com/u/5478701/Shadowtest_orig/shadowtest.jpg" border="0">

    You can try it out here.

    And here's the Capx file.

    One problem I'm having with it is the Additive blending mode on the light. It works fine as long as there's a background sprite is on the same layer as the light and shadows, but it won't work if the background sprite is on a layer below it. I can make the Additive blending work by setting "Force Own Texture" to No on the Light and Shadows layer, but this breaks the shadows. So it seems like I can't have both an 'additive' light and 'destination out' shadows at the same time, only one or the other. At the moment in the capx file, there's a second copy of the background sprite in the Light and Shadows layer (as well as one on the Background layer), if you delete this you'll see what I mean by the Addtive mode no longer working .

    If there's a way to get that Additive mode working with the shadows, then you should be able to have multiple light sources in different colours, which could be pretty cool.

    I hope somebody finds this useful, or could point me in the right direction to get the rest of it working. Thanks!

    Edit: I'm getting 60 fps in IE9, but for some reason it only works locally. In firefox I'm getting 50 fps, and in Chome I'm only getting 20! No idea why.

Puck's avatar

Puck

Member since 19 Jan, 2012

None one is following Puck yet!

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies