TMAJA's Forum Posts

  • Ok so I did a quick restructure and got what you want working . It was weirdness from the for each enemy loop and your subtract 1*dt. I removed the var6 code in the screenshot from the for each enemy loop and changed a couple of things.

    http://imgur.com/I9WklhU

    Ok I've added a link because the screenshot was crazy out of the box for some reason.

    This works how you want it, while the player is stood still. If you run through groups of enemies you will still see high hitbox values, because you are swapping var states as the player moves past and therefore removing the attack cool down associated with var6. I'd recommend adding another var (attack cool down) which is independent of the enemy state vars.

    Let me know if I can help anymore .

  • So I've had a play around with your Capx and as far as I can tell you don't need to remove all the var_state events from the for each enemy loop. The issue you described only seems to arise when you put the LOS condition inside the loop. When that condition is outside the loop, it all (seems) to work pretty well! Is that correct?

    I can only guess that this is caused by the system looping through the enemies quickly, which causes an problems with the calling of the every 2 second condition.

  • Hey, I can't identify an obvious problem from your events and it's a bit odd your first enemy works while the rest don't. I'm wondering if it is something to do with how your events are structured which is throwing the whole thing off.

    Could you post up/PM me your capx and I'll have a play around with it?

  • Are your levels dynamic/random or could you simply have a series of sprites over the different areas - when the player overlaps an 'inside sprite' you set the zoom to your desired level (using something like what puntodamar linked to above) and if they overlap an outside sprite you set the zoom to a much larger value. Although this is a bit binary, it would probably be a lot less stressful for the device performance wise.

  • Opens for me, I'm on r320.

  • Changing your 'window size' property will allow your camera to see more. You can access this by clicking on your top level project file in the project window.

    You should note that increasing the window size may also affect performance as the window size gets bigger (more for the system to draw/process at any one time).

    You could also scale all your sprites down so more fit on the screen.

  • Are your IDs fixed? IE: a hammer always has the same ID (let's say 0), axe is always 1... If your IDs are fixed, and can be numbers, then they are your Y index. Z is your instance variables.

    Hi BlackHornet,

    I figured it out, I understand exactly what you were saying now - my major problem was I hadn't made the item ID's numbers.

    Thanks for all your help, it's really appreciated!

  • Are your IDs fixed? IE: a hammer always has the same ID (let's say 0), axe is always 1... If your IDs are fixed, and can be numbers, then they are your Y index. Z is your instance variables.

    Yeah I think get what you are saying, but I still cant seem to get the data out of the array :S... This isn't my first time with 3D arrays either, I cant believe I'm so stumped on this.

    BlackHornet thanks for all your help so far, but would you just quickly write out what conditions/events you'd use to populate those variables?

    Seriously, thank you

  • You're thinking of storing the level and item, but that's not really the way to think of it, although there are different ways of doing it. You don't need to search for a level, your level maps to the index in X -> LevelA is X=0, LevelB is X=1... Your items map to Y, ItemA is Y=0, ItemB is Y=1. So the statistics for Level B, Item C are always (1,2,z). The array only contains the stat data. You do need to know the Y index for each item though. You could alternatively store the item ID always at Z=0, so then you could search for it in Y, and your statistics would always be from Z=1, to ...

    Thanks for the reply . I think I understand what you are getting at, but I still cant think how to get the data I'm after out of the array...

    Maybe its because my system is actually slightly more complex than I initially indicated, maybe I'm just being dense. The 'items' (objects on the Y) aren't actually items at all. They are simply IDs which are assigned at run time as an object is created - they how I planned on connecting the data on the Z with the object I just spawned.

    Basically I have items which I spawn in each level. I need to take information from an array and write it into those items instance variables. I'd like to just use one 3D array.

    Is there a better way of doing this?

    Thanks for your help, this is causing my a major headache!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok so if it is that problem, the issue is the way you have set up the On left button clicked conditions. You don't reference an individual enemy/member of the family so the damage is distributed across all of them. I cant really tell what you are doing with your red squares but you need to find a way of tying an instance of the enemy family to the damage - if you could explain how your conditions work a bit more I'm pretty sure we can figure out a solution.

    Feel free to PM me if you don't want to explain on here!

  • Ok so I think the problem is you are deducting the damage from all the enemies - just to confirm if you fire up the game with the debug layout enabled and you shoot one of the enemies, then check the health values does it deduct it from both/all?

  • Is it possible that when you attack one enemy you are altering the health on both of them?

  • Hmmm ok, I'm doing exactly that and my hostiles behave as expected.

    Does your code look like this?

    Enemy family - Health (less than or equal to) 0 | Enemy family - Destroy

    Do you have any extra conditions/actions in there?

  • You can't extract data from each dimension independently. A three dimensional array has to be indexed with an X, Y and Z index each time. Maybe provide a sample of the data in your array to make things clearer.

    Thanks for your reply BlackHornet,

    that makes sense, but how would I then extract data on the Z when my two potential X and Y are dynamic. I'll try and explain more thoroughly:

    my data looks like this -

    Level A - Level B - Level C (x)

    Item A - Item A - Item A

    Item B - Item B - Item B

    Item C - Item C - Item C

    (Y)

    On the Z axis there are stats for each of the items.

    This whole thing is so I can populate the items with the data from the array when I spawn them.

    E.G. I spawn Item A

    I loop through the array and look what Level I am in (the item stats change on different levels). Then I want to loop through and select the correct item in the array on the Y. Then finally I want to write the items instance variables with the correct information from the array on the Z.

    Does that make sense?

  • Hi, are you using a global variable or an instance variable to track your enemy health?