How do I find what i'm looking for

0 favourites
  • 4 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I'm looking for an example of a simple battle/fight system. I don't know exactly what to search for and the words i've used haven't helped. I have the hero and 1 monster at a time that I want to exchange damage. The system I have made works but starts as soon as the layout begins and I don't want it to start until the attack button is pressed or monster attacks. I also want to be able to stop the fight at any time and run away without a new monster spawning. Any suggestions or pointers to tutorials or capx would be very helpful

  • Use a global variable: myVariable = 0 ; when attack button pressed or monster attacks set myVariable to 1

    Under the condition that myVariable = 1 - Start Game [Run the events that start your game]

    -

    To stop the fight & run away without a new monster spawning: Use a global variable; On start of layout myVariable = 0

    Add myVariable = 0 to the condition you already set for the monsters to spawn.

    If monsters (INVERT)-Is on screen - set myVariable to 1

    If monsters Is on screen - set myVariable to 0

    To assure that monsters spawn when/where you want them to & there aren't any already on screen: clone your monster & set spawning events accordingly, i.e if myVariable= 0 & when you reach a certain point in the layout - you can use an invisible sprite to represent that "certain point" spawn monsters.

    or on collision with "certain point" set myVariable to 0 and spawn monsters accordingly based on is/isn't on screen.

  • ok thanks and that makes sense once it was pointed out to me. I was trying to figure out a way to use a function and wasn't thinking about globals as an answer.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yeah no prob, good luck !

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