Chris PlaysOldGames's Recent Forum Activity

  • Glad to hear.

    It could easily be scaled up to include more magazine sizes as well.

    Your also not limited to using globals (unless mag/remaining/ammo states carried to other layouts), you could put ammo as a player instance variable and then capacity/magazine/remaining as instance variables of a weapon sprite.

  • I threw together a .capx https://drive.google.com/open?id=0Bx-ufu2WID53c2ZiZzlmNXFETlk (click download arrow in upper right corner of screen).

    It allows you to reload from an ammo variable until its empty and continues to fire until the mag is empty as well.

    Its pretty self explanatory. I am sure it can be condensed quite a bit by someone much better with math.

    That said/done.. there is a reason that most games simply have an ammo pick up that refills your weapon completely then destroys itself and doesn't track how many rounds are in magazine, pick up, or have been fired.. without that logic the above capx would have been just a couple of lines.

  • You can try:

    [quote:1qf9u9zk]Give the enemy the "Custom Movement" behaviour, and set an event

    "Enemy - On collision with: Enemy - Enemy - Push out solid - Nearest"

    from this thread discussion (and its links): https://www.scirra.com/forum/viewtopic.php?f=147&t=88155&p=1028130&hilit=overlapping+enemies#p1028130

    You will ultimately find the answer is... "not easily done".

  • My bad, I was simply explaining how to transfer the value of a variable to another and stop it from going negative. I failed to read whole request.

    If someone hasn't done so, when I get off work I will throw something together.

  • magazine=ammo

    Every time you update the magazine value after ammo is picked up simply set value of magazine to the variable value of the ammo variable. Have another action that sets the value of ammo to 0 if its less than 0.

  • like el3um4s points out, your sprite is already mirrored to the Right animating one (ie. facing the opposite direction).

    You would only use mirrored if you were using just one sprite animation and wanting to "mirror" it so you didn't have to make an animation in the opposite direction.

    Since you have a left facing and animating sprite already you can simply removed the mirrored actions completely.

  • Do you pin your animations to a controller sprite?

    You can avoid many animation issues by using a controller sprite object. Simply make a sprite that has your "characters" collision bounds (ie scaled to character sprite size with appropriate collision bounds) and then set it to invisible. Give your character that is animating a pin behavior and simply pin it to the "controller" sprite when it's spawned. The controller spite would get all the stuff you would put on your player.. instance variables, movement behavior, physics.. etc. and the animations would just be pinned to its location and not actually interacting with anything.

    In your example you could then pin other invisible sprites to the controller for sword collisions and such and match them to animations...

  • Could you not just copy/paste the explosion event and sound triggering event triggered once, twice with a 2 second wait between?

    If its a random 2-4 times you could nest them under a primary variable testing event that got a number and then filtered any remaining times with else condition...

    ie. something like:

    times=choose(0,1,2,3)

    play explosion event

    play sound event

    if choose = 0

    play explosion event

    play sound event

    else if choose = 1

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    else if choose = 2

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    else if choose =3

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    wait 2

    play explosion event

    play sound event

    I am sure it could be written much more efficiently.

  • If you're wanting it to always be a different enemy then I would go the instance variable route like badmoodtaylor suggested. You're question sounds like you want this difference across multiple levels (layouts), so you would need to store the enemy number that had key last time in a global and filter him out next spawn.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For global you would use System object: Compare value event.

    When you choose the compare value event you will be asked for the required comparator.

    Then you can action out your event based actions... spawn sprite at x,y or whatever

  • Welcome to the wonders of "instance picking". Search for it in the forums, tutorials, and manual.. lots of stuff on it.

    TL;DR... you have to find a way to tell construct2 to "pick" the bat instances individually so it knows which ones to act on. This can be done many ways.. I would think in your version it would be best to use the instance variable for speed and then set it "On Create" of each instance to a random number... or if you wanted more realistic bat action you could simpy have a randomizing event that runs in the back ground choosing a random instance of "bat" and changing its speed to a random value every X seconds...

Chris PlaysOldGames's avatar

Chris PlaysOldGames

Member since 22 Aug, 2014

Twitter
Chris PlaysOldGames has 1 followers

Trophy Case

  • 10-Year Club
  • x2
    Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

12/44
How to earn trophies