How do I make this chemical reaction work?

  • Hey! I am relatively new to Construct 2 and I was looking for some advice on a project that I am working on. Using Construct 2, I am trying to show how H2 and O2 molecules react when you add energy (in the form of a sprite) to the container. I tried setting it so when Energy collides with Oxygen, they both are destroyed along with 2 Hydrogen sprites and 2 Water sprites are produced. The only issue is, ALL of the water gets destroyed... I then tried to mess around with global variables and see if I could make it so when the global variable notices -2 to Hydrogen, then it destroys 2 Hydrogen sprites. Any ideas?

    Any Input is helpful drive.google.com/open?id=0B7bFgGCJ0UWUfkwtcl94MWg5T0czdjdPQTNoa1dFOGFSVTJiZjFwR3R4WDVXR3ViODVQWWM&authuser=0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your link is unavailabe..

    When clicked it tells to ask permission.

    But what we have here is a picking problem.

    If you want to select two random instances of hydrogen it would be as easy as

    repeat two times

    pick random instance of hydrogen.

    so:

    energy on collision with oxygen

    energy destroy

    oxygen destroy

    • (subevent) repeat two times

    -- system pick random instance of hydrogen

    hydrogen destroy

  • Thanks for the help! I'm going to test that out when I have a chance. I will also check the permissions for that google drive link, sorry that you were not able to view the .capx file.

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