shewhorn's Forum Posts

  • 14 posts
  • Hi, hope you can help,

    At the end of a score summary sequence I have made I want to spawn a continue button to advance to the next step. Throughout the score sequence I increment a global variable called UIProgress in order to cue the next step of the sequence. This works fine I think, however, when I get to the end and look at it in the debugger I am getting multiple buttons created by my last event and the global variable takes some time to update.

    The final event goes:

    UIProgress = 9 -> Set UIProgress = 10

                      Call function "SpawnButton" (Bunch of params for the button)

    I guess the reason I am getting multiple buttons is because it is going through this event a few times before the variable is getting set to 10 but I don't get why. I don't always get the same amount of buttons created either and am a bit baffled. Anyone have any ideas? I have tried adding a small wait timer and it improves it but doesn't fix it.(between 1 and 4 buttons created rather than 7-20 ish)

  • That fixed it!

    Thanks so much.

    I swear I'd tried wrapping the variable reference in all sorts of int()/float()/string() string expressions and nothing worked. Must have been doing something stupid.

    I know why the array has it as a string value. I have all of my data for my enemies load into an array from an xml. If I use xml.NumberValue I only get ints out and some of my data has decimals. To get round this I have them all stored in the array as strings.

  • Does anyone know if there is any way to pass a variable to the Array.IndexOf() thingy?

    If I had loads of UIDs or something similar loaded into an array and I wanted to find what it's X was, how do I do that? It looks like Array.IndexOf(Object.UID) doesn't work, the only time I can get a result out is if I specify the number in quotes i.e. Array.IndexOf("111"). This isn't of much use to me

    I've tried looking through the other topics and can't find anything.

  • What does this mean?

    "remember to delete caches and appcache in case you're exporting"

    Where can I do this? At the moment I'm just previewing it in Chrome.

  • So after repeatedly trying the same things last night, and, with the events etc. looking absolutely identical, it has started working. I have no idea what I did and looking at an example that does vs one that doesn't work I can see no difference.

    I'll try post a capx of it tonight for anyone else having similar problems.

    Also, if anyone has the slightest idea why it just worked I would still be very interested in why this is. I hate not knowing why it works.

  • Hey, thanks for all the replies!

    I've tried adding in the text() and number() stuff but it still doesn't work. The things is though, it's even stuff like node count. If I do that in my test project it works (as well as the resizing of the array based on that). I can't even get the node count to work, even using the same xml and the same event in the two projects. one it works, the other it doesn't :(

    I don't think I want to be using dictionaries for this as I will eventually have between 7 and 28 enemy types, each with ~25 variables each. I want to use the xml and array solution so that i can easily balance all of the numbers in excel and see them all in one place before saving them out to xml. It seems more scalable to search an array for an ID at X and then get all of it's values from the Ys. This means I will only need 1 function for setting any enemy's variables as long as they have the correct ID set in their instance variables. In addition, once I get this code working I want to be able to extend the same sort of thing to everything that is variable heavy in my project. Environment settings, map data, weapon variables etc.

    If anyone can help me get this working I'll be eternally grateful.

    I've put my test project capx here:

    docs.google.com/file/d/0B3RLm-IgrMQEaFVVX2VzZ1JZdGs/edit

    And my main project here(at the end of the event sheet 'main'):

    docs.google.com/file/d/0B3RLm-IgrMQEYThEVEpFVHlIbWM/edit

  • Hey all,

    After tearing my hair out for a while now I have decided I need the help of people who know what they're doing (at least a bit more that I do!).

    What I want to do:

    My basic problem is that I have an xml full of all of the variables that govern my enemy's attributes. I want to load this into an array at the start of levels. I would then spawn a blank enemy with instance variables that are populated from the array based on spawning logic e.g. spawn enemy, get type 1 stats, set animation to frame 1, off you go.

    I created a mini project to test the basics of this out and I got it to work fine. Much smaller xml and array but all in the same layout and format. I tried implementing this in my main project and everything works right up until I try and do anything with parsing the xml that has been loaded.

    xml i'm trying to use is:

    docs.google.com/file/d/0B3RLm-IgrMQEX2RTVGxSdGk0WWc/edit

    This is the code I'm trying to use:

    <img src="https://docs.google/file/d/0B3RLm-IgrMQEVGN1N0ZBSjVrQmM/editusp=sharing" border="0" />

    (https://docs.google.com/file/d/0B3RLm-IgrMQEVGN1N0ZBSjVrQmM/edit?usp=sharing)

    I'm hoping it's something really dumb that I've done. I only started the xml stuff a couple of nights ago.

    Any help would be much appreciated...

  • I have a similar problem I think...

    I have a lot of enemies that converge/follow/move in packs and I'd really like them to space themselves while moving.

    I've tried the solid push out thing but it's a little jumpy. It'd be great to find a solution for it without having to really complicate my enemy movement.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Awesome, thanks!

    I now have a huge pile of things generic to each enemy that now just handle themselves without having a million different sprites about.

    For anyone else, basically I do:

    On enemyfamily create -> Spawn healthbar

                       Spawn shield

                       Spawn other things

                       Set healthbar ID to enemy.UID

    I then do a for each healthbar with

    enemyfamilypick instance with UID healthbar ID

    Works great and means that my event sheet is a lot smaller as is the list of objects in my project.

  • Hey,

    I have a bunch of enemy types that I want to share the same health and shield meter sprites.

    As I can't add the same sprite to each enemy's container I was wondering if there was a way I could achieve something similar without having to have a bunch of different health bar sprites? If I have to have a specific life bar sprite or shield sprite for every enemy my project it going to get a little unmanageable.

    Appreciate any help you guys can give, you already sorted my first problem in record time.

  • This actually just worked straight up, my problem was that for some reason I had the enemy ID check nested underneath the vision cone check.

    Thanks for the help guys, you got me past a very frustrating problem.

  • Thanks for the quick replies guys, sorry I have been so slow :( Computer troubles.

    I should be back up and running tonight so I'll try tidy it up and post a version on here.

    Good to know I'm on the right track though.

  • Apologies if this has been answered out there, I have looked, a lot and have not been able to find anything that fully explains what I'm after.

    My basic problem is keeping track of everything relating to an enemy instance, for example:

    I have 10 instances of an enemy spaceship each one having:

    health bar

    shield

    projectiles

    a vision cone

    What is the best way for making sure that when something happens to one of these objects I can relate it back to the right enemy?

    I currently have everything in a container which is working for the health bar(which scales its length based on an instance variable on the enemy), however, when info goes the other way it applies to everything, for example:

    Enemy vision cone collides with the player, firing event triggers for all instances.

    Player projectile hits enemy shield, shield strength variable is decremented for all instances.

    I thought something to do with assigning the same ID to everything in the container on create might work but I can't work out how to do the check like:

    on collision

    vision cone ID = 34

    -> Enemy ID = 34 -> Spawn bullet

    I hope this makes sense, I'm not too experienced yet but I figure this would be really helpful to nail as early as possible so I can get my core gameplay up and running.

  • I've actually just made something like this myself and found that one of the most annoying things to get right was the delay before the shield was able to charge (I assume you want this if Halo is inspiration).

    In my project I have a physical shield that disappears when exhausted so it is slightly different but essentially I have:

    A timer that registers time elapsed since last hit:

    On contact with an enemy I reset this to zero

    It counts up to three and then stops

    On the timer hitting 3 I set a bool ShieldCanCharge to True

    On being hit by an enemy I set it to false.

    For whether to damage health or shields I'd do

    if shields > 0 do damage to shields

    else

    do damage to health

    As for the recharge, have a max charge variable, a charge rate variable, you then check the shield bool is set to true and the shield is not already at max strength and charge away.

    Apologies if this reply is a bit rambling and useless, I've only just started tinkering myself and know nothing really. I have some shields that work though. I can post capx if interested but I'm at work atm.

  • 14 posts