Rable's Recent Forum Activity

  • nimos100

    Your solution works perfectly and is easier than mine. Thanks a lot!

    I conclude that the condition "on value changed" simply doesn't exist, but as you stated, calling a function when modifying the value is probably more efficient.

    Thanks for giving further informations. In this case I'll use nimos' solution (which is already implemented and working) but will definitely keep yours in mind for the next time.

  • I would like some actions to run every time a certain global variable is modified in my code, but I can't find the way to do that it in the editor. Does a condition like

    "On Variable value change"

    exist in Construct 2?

    I can imagine creating another global variable, checking if the first variable is different from the second, then copying the first variable's value to the second at the end of my event sheet, but it seems quite complex for such an easy thing.

  • I spotted the problem : instead of applying the character width to the font family, as suggested in the forementionned tutorial, I changed the code and applied it to the font itself. This makes "on created" to work just fine!

    "On start of layout" still doesn't work though.

    Thanks a lot for your help in solving this problem!

  • blackhornet

    Thanks for the reply!

    Actually I was able to make the sprite sheet's character width being normal by applying the character width action every tick. I also tried to create a function with the include, and call the function every time text is created, but the character width is not applied.

    A simple question : does setting the character width at the start of layout set it correctly for the entire layout?

    If yes, I probably have a problem in my event sheet, though I checked it many times and am not modifying character width anywhere.

    To reply your questions :

    A) I sure did.

    B) Not at the moment because this is a project for my employer, so I will need to create a simple example using a different font (the sprite font I use is copyrighted by my company). But if your reply to my question above is affirmative and I am unable to make it work even in another simpler project, I will upload it for sure.

    Thanks again!

  • I used Intel XDK for both iOS and Android version. Quite happy with it though it hasn't been easy to implement (I guess platform deployment is never easy).

  • Hi,

    I'm experimenting with sprite fonts and I have something weird happening.

    As explained in this tutorial, I put the character width actions in a "on start of layout" event.

    During my layout, I create 2 times the same sprite font object, with the exact same text. the first time it is displayed correctly, the second time, the character width actions are ignored. Even if I copy all the character width actions after the object creation, it is still ignored.

    As suggested in the tutorial, I put all my character width actions in a separate event sheet, and included it in an "on start of layout" event. I noticed that if I put the include in an "on start of layout" event, it is ignored even the first time, while if I put it simply on the top of the event sheet (even above the variables), the first time it's ok, then again it is ignored the second time the text is displayed.

    Any idea of what's happening?

  • Let me tell you something. You absolutely ROCK!

    I tried your solution exactly as you proposed it, and everything works wonder! Now both effects are implemented nicely into the game, and my code is cleaner and shorter than it was before, also thanks to the advice of other people in the first replies, which also have my gratitude. But best thing is that I learned a lot.

    Thanks for your kind words about my game. If you like the mobile version, chances are you will like the PC version I'm working on. The mana bar is now placed in the center bottom, but it's not as important as it won't be touch-based anymore and you shouldn't have your thumb before the screen. But I keep your feedback in mind for the next mobile update.

  • Wow, thanks a lot for your time and explanations! I think your solutions should work.

    I'll try it tonight and let you know how it goes.

  • It will surely work if you copy health to health2. You can leave all your conditions as they are and use health2 variable only to pick the lowest health alive.

    Actually, once I picked the lowest health character alive in the family, I still don't see how I can modify the health of the object's instance variable... Is this possible?

    I mean, health2 would be the family instance variable, and the family member will be selected, but how can I add health to the object instance variable without knowing which object it is, even if there is only one object picked?

    As far as I know, it is not possible to modify "health" to the family object picked if "health" is not a family instance variable, even though all the object in the family have such an instance variable defined.

  • Oh that's awesome, I wasn't aware of this "pick lowest value" in a family condition. I checked for it in system conditions but was unable to find it. Great! Thanks!

    Hmm, yes I'm tempted to do the leap and remove all my "health" object instance variable by a "health2" family instance variable. But, let's face it, I have more than 25000 events in my game right now, working on it for more than one year, and as the game is "Healer Quest" I let you imagine how often I am referencing to the "health" variable... ^^' Probably thousands of times...

    Is there any way to do the job more quickly than creating "health2" as a family instance variable and edit manually ALL instance of the "health" variable to "health2"?

    At first I was thinking about copying health to health2 every tick... but I need to use health2 for the effect we are talking about (the effect will be to make the character gain life), so I doubt it will be of any use. :/

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the message. To reply your questions I have most of the time 4 characters to manage. They are all separate objects (but together in a family, though all instance variable are object-based (see EDIT above)). Furthermore, they may die and come back to life later in the same stage.

    I'm sorry to say that I probably don't have enough knowledge to fully understand your proposal. I can sure create such a dictionnary, but I have a hard time understanding how it could relate to picking one character at random, even more since the characters are 4 different object. Could I ask you to ellaborate a little bit further?

  • Thanks a lot for the solutions! It will be quite easy to put in place.

    EDIT : not so easy actually, as each instance variable of my characters are implemented as object instance variable, not family instance variable. The problem now is that I can select the correct character using the "character" family, but how can I impact the health of the selected object instead of the health of the family member selected? (the Family has no "health instance variable, only objects).

    I tried to delete the object instance variable and recreate it in the family, but deleting it would delete all actions and conditions, and thus not be possible. Is there any solution? Rewriting my code and put all health and other object instance variables to family instance variable is not an option at this stage.

    Now I also would like to create another effect in the same vein, but this time, instead of picking an instance at random, I would like to select the alive character which has the lowest health.

    I could start the same way by selecting the characters who have their "alive" value to 1, but then I don't see how I can compare the values of their current healths in order to pick the lowest one. Is there a way to do so efficiently?

    I thought I would be able to do so with "pick by evaluate", but it seems like it could only compare different values between them, not picking the instance which has the lowest value of one family instance variable.

    Another way would be to not use families, but the way I described in the first post and do :

    min(char1.health, char2.health, char3.health, char4.health) but only taking into account the values which are higher than 0 (otherwise it means the character is dead).

    Any idea how I could do one of these?

Rable's avatar

Rable

Member since 6 Aug, 2014

None one is following Rable yet!

Connect with Rable

Trophy Case

  • 10-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

15/44
How to earn trophies