Tobye's Recent Forum Activity

  • Hm, no I haven't seen any. I learnt all this stuff myself and don't have any demos ready. But I will try to explain it:

    1. Create an array in the editor. Add an instance variable to it for each value you wish to store (attack, defence, etc.)

    2. On start of the game, destroy array (just to keep it clean)

    3. Condition 'on character created' > create object 'array'. Set value of array's instance variable 'id' (which you also include when creating the variables for the array) to 'character.uid'. Then set all other variables to the desired values.

    4. Whenever something affects 'character', pick the corresponding array by adding the condition 'array.id = character.uid'. Now alter the values of the array's variables asthough it was the character.

    This is a very simple way to do things that still allows more flexibility than storing the values directly on the character. If you think that you will need more control over the information, then yes also use the array's cells.

    I don't have time to fully explain my methods for that right now sorry, but essentially you just use 'push' to add a string value (say 'attack') on the X axis, then values on the Y axis (starting from 1, because 0 will be your string). Then you can do things like run loops for 'array.height' times, using local variables as counters to get the value for each cell under a string: array.At(array.indexOf("attack"),counter))

    That method is actually quite easy to use, just there is a lot of possibility so deciding the right ways of indexing and retrieving the information for your game will likely take some time and thought. Hope that helps!

    EDIT: Also in case you haven't noticed, I'm not a fan of using a single array for all the characters. I really can't see any reason to do it that way and many reasons why not to. So unless you have a very specific reason for doing so (and if you do I'd like to know why out of curiosity :) ), the main thing I suggest is to store values for each character in their own object.

  • But arrays do store strings...? I have used them several times for exactly this. But now that you can just save the game state, I prefer to just use variables on arrays. This works totally fine unless you are doing something like a CCG which requires in-depth information, like how many times an attack has had a modifier increase.

    EDIT: I should clarify that I prefer variables on arrays, then creating an instance of that array when a character is created and linking it to them (set instance variable 'id' to character 'uid'). It's a better method than storing the variables directly on the character for a number of reasons, like if the character gets destroyed but comes back later or you find you do want to store some info in an array later down the track, or maybe you want to store the data of each character for a debriefing layout.

  • One solution is to make it when it is no longer pushing out, set Mario's Y to that of the platform. Might not work for you depending on how you have your game set up, but that method has solved a number of problems for me in the past.

  • Link to .capx file (required!):

    dropbox.com/s/xpp3lfws3ps890f/bugging%20out.capx

    Steps to reproduce:

    1. Load layout 'Level 1'

    Observed result:

    Bullets spawned will always attach to the angle of the turret, even up to 0.019 seconds after being fired. This means you can't set the angle of the bullet 'on created', as it will always just revert to the turret angle.

    The turret waits 0.016 seconds to change angles which is the lowest amount I could get to where it will still occasionally change the angles. So you will see some flying off now and then, but the bulk of them heading directly straight. Remove the wait timer to see them all go straight or set it to 0.02 or higher to see them consistently change angles after that time.

    Also the 'on created' angle changing works fine on other objects, until they move. You can see this by controlling sprite6 using the arrow keys. The will spray off in all direction, until you hold up/left/down, but strangely it will work normal when facing right.

    Lastly, if you use 'system > create object' instead of spawning the object, on-created angle adjustments work.

    Expected result:

    All shots fire with randomised accuracy.

    Browsers affected:

    Chrome: yes

    Firefox: yes

    Internet Explorer: yes

    Operating system & service pack:

    Windows 8 and don't know

    Construct 2 version:

    130

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ramones - Thanks for that! I don't know why I never thought to try it that way. I guess I should report it, I have come across other problems with angle setting in pathfinding behaviour too.

  • I have my little tank game going gang-busters, but all of a sudden I have run into a problem! When the turret 'on shoot' spawns a bullet, the 'on bullet created > set angle X' no longer works! It will always just set the bullet to the same angle as the turret.

    This was not always the case, I remember when I started this game that they would take into account accuracy variations when shot with turret behaviour, and if you say 'on bullet created > wait 0.1, set angle to X' it will work. The lowest wait period I could get it to work for every shot was 0.02, and it would work for some shots all the way down to 0.016.

    Does anyway know exactly why this is? Or how to solves the problem? I have been stuck on it for a few hours now, which really is too long for something this simple :(

    Also I noticed that if non-turret behaviour objects are firing shots, it will work as intended until they move (either with pathfinding or 8-dir behaviours).

    Capx: dropbox.com/s/xpp3lfws3ps890f/bugging%20out.capx

    And if anyone happens to know in which version that problem started I would like to know, it would be worth me stripping back to it :)

  • jayderyu - Great, thank you! :) Let me know when it comes about or if you need help testing or something.

  • - I actually spent a long time on this after your suggestion, and eventually decided on adding the variables for the condition to the object was in fact just easier to manage. But for additional details like time remaining, times hit, etc. that might be used by the status are stored in a dictionary that is created when the status is applied and linked to the object via UID.

    I know it probably sounds a bit much, but it has really made it much easier to manage and debug. With arrays it just takes a little more eventing time to extract the information and when you run into a problem there's a lot more possible reasons for it.

  • jayderyu Velojet - Hey guys, I made a little game where you make an action (like 'move here') then the game plays out by itself for a while before pausing and asking for another input.

    It is currently a single player game, but I designed it this way in case multiplayer did come along one day, to get some live-action happening without input lag being a problem (so say all players have 5 seconds to make a command then it plays out).

    So I'm wondering if what you guys are doing could work like that, where the server determines the times to make moves as opposed to each individual player's game, and whether there are any special considerations I should allow for? For instance, I now have a boolean that says whether it's a friendly or enemy unit, would I be able to easily assign that boolean to a player or should I use IDs or...? And how easy would it be to save results, like kills and exp gains, for each player? (Currently I only want 2 players)

    I'm not asking that you hurry along or do anything specifically to cater for my game, I'm just after some pointers on how I should be structuring things in case it does come about one day :)

  • Hey all,

    I am wondering if there is a way to load up a single text variable with a bunch of different words, and be able to check if it contains one of those words and be able to delete just the specified words.

    I am trying to make a single variable that can store all the statuses applied to a character (like poison or haste) to try to cut down on instance variable, as there are already heaps.

    Or if anyone has any other ideas how to manage statuses it would be nice to hear :)

  • BluePhaze - Thanks for the additional testing ^^ I had just started with it and wasn't aware of any of those yet. I also found if I boost down and hit the ground before boost ends I will float off the ground a little.

  • OrangeTapioca - yep! Although I can't get any direction to work off it, ever. Yet I can still get it to destroy itself under the same conditions, although it works a little sporadically. All individual buttons and other combinations work fine.

    - Thanks! Maybe that does have something to do with it.

    EDIT: - That must be it. I found if it press left, then up then B extremely quickly one after another it works. Dodgey keyboard I guess. Thanks!

Tobye's avatar

Tobye

Member since 27 Jul, 2012

None one is following Tobye yet!

Connect with Tobye

Trophy Case

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

Progress

14/44
How to earn trophies