Cross_'s Forum Posts

  • Hi there !

    I used to work for a company similar to Scirra, programming game engines. Eventually I moved on and currently my day job is writing Android native / Android Java applications.

    Recently somebody was looking for an HTML5 coder and mentioned Construct2 as a possible engine. It only took 6 hours to implement a Duck Hunt clone which had me hooked :)

  • kyatric has it right.

    rock & box collide: don't do anything

    dart & box collide: create a distance joint between dart & box

    dart density: small number

    box density: medium number

    rock density: big number

    Keep increasing rock density & box density until it looks right.

  • Yann:

    No global objects, and I am calling "reset global variables" after the level is done.

    Kyatric:

    Can't post the capx due to copyright issues (artwork is done by client, not by me)..sorry. Here's a description of what's going on:

    the game is basically a shoot'em up like the Space Blaster example. In the editor I have placed about 70 enemy sprites with some instance variables like health, point value, etc.

    As the player scrolls along, the enemies come into view. Once they do I start their custom movement and the player tries to shoot them. Once the enemy health reaches 0 or when it leaves the layout I destroy the enemy.

    Eventually I do a goto Layout ("Game Over") followed by resetting global vars and then return to the same level, i.e. goto Layout("Main"). At this point MOST of the enemies seem to have been reset. But some no longer show up.

  • This is probably what I was briefly mentioning in the PM last night.

    My game is designed for portrait orientation, full-screen sprites for backdrops (1680x1050) are set to a 90 degree angle. To make things easier I moved the origin in r74 sprite editor to bottom left and then assigned the sprite to position (0,0).

    In r75 I sometimes see the sprite lined up properly (filling entire screen) and sometimes it is shifted, as if the sprite's origin was in its center instead of its bottom left. Resetting the origin in r75 sprite editor did NOT resolve this however.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am doing weird things with my sprites during gameplay, but my question is this:

    Once the level is complete, how do I completely reset a layout to its original state?

  • It's happening 100% of the time with both r74 & r75 64-bit builds on my machine.

    I have now switched to the 32-bit build and that's working fine.

  • My layout loop looks like this:

    Intro->Main game->High Score list->back to Intro

    The Main game layout is a huge level with sprite instances created inside the editor. The first time through everything works as expected. But once I reach the High score and then return for a second playthrough some of the sprite instances have disappeared.

    Is there a way to do a clean reset of the layout so it's exactly the same as it was the first time through ?

    I am calling System.ResetGlobalVariables after the High Score layout but still occasionally some of those original sprites don't show up.

  • Observed behavior: Construct2 crashes when clicking in Properties panel of (some) animated sprites.

    Steps to reproduce:

    a) open my (rather large) project,

    b) go to Main layout

    c) select one of the animated sprites (e.g. JAS2100, M1A2) in Objects panel

    d) left click in Properties panel in a blank space, e.g. right under the "More Information" line at the bottom

    System: Win7-64

    Construct2: R75 Free (64 bit), Business (64 bit)

    CAPX sent to Ashley via dropbox.

    NOTE: With R75-32 bit version this crash does not occur!

  • Yep, they all disappeared at the same tick.

    The C2 System manual states: or Each is commonly mis-used or used redundantly - actions already apply for each instance picked by conditions, so it often is simply not needed.hat's why I tried to remove the ForEach because it sounds like C2 should already be iterating over each instance that disappeared during that tick without me having to run a ForEach condition on it.

    For reference here's the bad code again:

    <img src="http://i.imgur.com/6iRz9.png" border="0" />

  • Normal, you set Respawn to 0 every tick o.o

    But event sheets run from top to bottom, so it should only be 0 at the very end of the tick.

    This is the pseudo-code of what I had in mind:

    foreach monster:

    Subtract dt from monster.Health

    foreach monster:

    if monster.alive & monster.Health<=0 :

        destroy monster

        increase RespawnCounter by 1

    Repeat RespawnCounter times:

    System create new monster

    System Set RespawnCounter=0

        

    So first we decrease the lifetime counter for all monsters. Then pick the ones that have lost all their health (and have their "Alive" flag set) and kill those. For everyone that got killed increment global variable so we can respawn them later. Next run a loop and create a bunch of new monsters. Once we are done with that reset respawncounter to 0 so no more new monster appear.

    I am completely aware of the fact that you can get the same behavior with a dozen different conditions/actions. My question is: why is the example I posted in the OP not behaving as outlined in the pseudo code above? The monsters all disappear but only 1 new monster gets spawned. It's as if the Repeat loop only runs once.

  • You don't really need a 'Alive' boolean because the very fact that the instance is not destroyed means that it is alive.hat variable is used somewhere else in code - once we start the death animation of a monster I set it to false so that no other actions are performed on that instance.

    nd indeed you don't need any foreach as long as condition on objects only relate to themselves.hat's what I thought and which is why I am puzzled about the behavior I described above. The first & second version I posted SHOULD behave the same way in my opinion. Yet the second one never seems to increase that Respawn counter past 1.

  • Thanks smitchell- got the locals & extra event sheets working now.

    Is there a way to have something akin to procedures/functions in C2? Let's say every time object A collides with object B I want some complex action to take place. However, when user presses the spacebar I want that same complex action to occur. What's the best way to go about this without copy/pasting everything ?

  • I just started using Construct2 the other day and so far I am quite impressed. However, the event filtering seems a bit confusing even after reading the manual pages here on the site. Maybe somebody can shed some light on how things are supposed to work.

    What I was trying to do is decrement a monster's health counter every tick, check if it's reached 0, then delete the current instance and spawn a couple of new one somewhere else later.

    Here's the implementation that works:

    <img src="http://i.imgur.com/4MNlH.png" border="0" />

    (Alive and TimeLeft are instance variables that are initialized to True and 5 respectively. RespawnCount is a global var)

    That Foreach loop looks redundant so I tried this approach instead:

    <img src="http://i.imgur.com/6iRz9.png" border="0" />

    The monsters still die after 5 seconds, but even if there were 10 on screen only a single new one will spawn. Why ?

    Just for completeness sake- if I were to add a "System- Every tick" condition in front of #10 or as a parent-event of #10 would that have any impact at all ?

    (By the way I have a few decades of C++/Java experience- feel free to get as technical as you like- I really want to learn how C2's event loop works)

    Some random questions:

    The manual mentions local variables, but I don't see an option to insert them. Is that a restriction of the free version ?

    There's an "Add Include" command, but how do I create a new Event Sheet for it ?

    Exporting to HTML5 (with/without Minify) just shows me a black page when I try to run the index.html in Chrome. Preview from C2 works fine, uploading to Chrome Webstore and running the game from there works as well. However, I would like for this to be an offline-only game; what's a simple,reliable way to achieve that ?