Randomly generated parties

0 favourites
  • 6 posts
  • I'm reasonably new to Construct 2. I've done a couple of the tutorials making the Ghost shooter, breakout clones, and platformers so I understand the general workflow.

    I'm looking into working on my own thing now and I'm not sure how to manage a central aspect of it. From what I understand sprite is a plugin you use to create objects that you can then instantiate to create many copies.

    I don't think I can use that for what I want to do. I want to create adventuring parties of 6 characters. Each character will be an object that has a number of attributes that might change, including things like a randomly selected representation graphic, 4 stats that are randomly generated, a character class that's randomly generated, etc...

    Does Construct 2 have something already set up along those lines? If I use something like an array, how would I tie the generated information in the array to a represented "sprite" on the screen?

    Thanks for any help you can provide.

  • I would store all the character details as instance variables in the sprite object.

    If you are going to have a lot of animation for the characters then you would make a small invisible sprite to hold their variables and location on the screen, and then pin another animated sprite on top of that for things like walking, idle, jumping, falling, fighting, dead, etc.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why would you suggest one sprite for variables and one sprite for graphics?

  • I've gotten a bit further along and I'm now generating a screen of six adventurers, each with instance variables for their stats.

    The problem I have now is it continues to randomly generate stats even after filling all of the available slots. I've attached a .capx file. I'd rather have one code block that populates all six instances rather than having to make a block for each of the 6 slots if possible.

    Note: Remove the space after "https://" as my forum account doesn't have URL permissions yet.

    https:// dl.dropboxusercontent.com/u/14668079/DPM-A1.capx

  • Event sheets continuosly loop, executing the code over and over again. So your code to create characters is repeating forever.

    If you want code to only run once when your layout starts (like creating characters), then create an "On Start of Layout" section and then make your "For Each" loop a sub-event of that. Then it will only run when the game first starts.

    Your characters are being set up the way you want, but the info displayed on the screen is the same for each character because all your text fields have the same names - so each time it creates a new character it updates ALL the text fields on the screen.

    To fix that you either need to give them unique names, or select the ones closest to the Spr_Adv_Border, or create the text boxes when you create the Spr_Adv1 charater...

    I tweaked your capx to make it work. you can get it at: rieperts.com/games/forum/DPM-A1-fix.capx

    The reason I suggested a sprite for variables and one for graphics is because the graphics will change based on how you generate your characters (male/femail, old/young, etc.) and as you will give them different animations. You need to have base objects that you know the names of to manipulate within your game. Then you apply the desired graphics you need on top of those...

  • AllanR, thank you so much for taking a look at this and for your explanations. This information should be a huge leg-up for what I want to do.

    I really really appreciate you taking the time to explain it all and even make changes to my .capx.

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