Rable's Forum Posts

  • Hello,

    This is a pretty basic thing I am trying to achieve. Still, I can't manage to do it properly. I even thought about posting it in beginner's questions forum but well...

    So I have a family "allies" with 4 object in it : "knight", "berserker", "archer" and "sorcerer". There is a "char" family instance variable, and I defined it to the exact name of the object. So to be clear the "knight" object's "char" variable is defined to "knight", and same for the 3 other objects.

    Now all I want to do is select one of the alive allies at random and know its char value in order to apply a function to him.

    I do :

    Allies health > 0 ("health" is another family instance variable of course)

    (in a subevent) Pick a random allies instance (up to there everything is working fine, I have checked in the debugger)

    (subevents of the previous subevent) Allies char = "knight" --> do something

    Allies char = "berserker" --> do something

    Allies char = "archer" --> do something

    Allies char = "sorcerer" --> do something

    If I'm correct, the "do something" part should apply only to the instance picked at random, but it actually never triggers, for none of the allies.

    Any idea of what I am doing wrong and how I could fix it?

    Thanks in advance!

  • Thanks a lot for sharing. A quick question, does the skew effect requires WebGL?

  • Oh, sorry, I just forgot to add the 4 image points! I was to enthusiastic to take the time to place them. ^^'

    I'll try again and I'm sure it will work this time.

    Thanks!

    Edit :

    Wow, it's working perfectly now! Thanks a LOT R0J0hound , without your code I would have had to use a completely different (and lesser) solution.

    Thanks a lot to rexrainbow too, of course, for the original moveto behavior!

  • [Discussion is getting a bit out of the Moveto Behavior's scope. If that's a problem I'll post this thread in another place]

    R0J0hound

    Wow, this seem to be just what I need! I implemented your code in the game's code, but up to now I didn't manage to get the same result as in your capx... I don't understand very much what's happening, but deleting the "solid" and "pushOutSolid" behaviors and replacing them with your code (updating the player and wall objects with mine, of course) let the player pass through the walls.

    I tried to change the 16 value that you suggested to change, it behaves differently but not really better, being stopped by the walls but "jumping" from one palce to another.

    Any idea of what's happening? Any advice on how to implement your clever code into my game's code?

    Here is the capx of this part of the game :

    https://www.dropbox.com/sh/j9hoth2oty56 ... tKYWa?dl=0

  • rexrainbow

    Thanks for these awesome plugins. Up to now, MoveTo is the best solution I found for making my character move on the world map, used in pair with PushOutSolids.

    However, I still get strange behavior in certain situation, and I thought that I could show you what it is in case you would like to update the behavior.

    Here is an animated gif of the problem :

    http://giphy.com/gifs/3o85xFKfz2HmfuBMCQ

    I think the problem is clear but to explain it further, I just click once just before the character starts walking. At first he goes to the point I clicked... Until he colides with a solid. At that moment he suddenly starts walking around the solid but in the wrong direction (top instead of bottom). I encounter this problem very often, and I'm afraid I won't be able to use your behavior if I cant' find a way around that problem...

    To make things even more clear, here is the same situation with solids visible and colored :

    http://giphy.com/gifs/3oEduGqATSWgHh1JHW

    Is there a way to avoid this problem and to make him move nicely in the correct direction?

    Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Works perfectly now, thanks a lot!

    And here is the final effect. <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    http://giphy.com/gifs/game-healers-ques ... 1qhQp5sa4g

  • Indeed, I use Z-order now (move to object) and it seems simpler. thanks for the tip!

    However, it still doesn't work and I guess I know why. I simplified the code, saying that there was one object but there is actually more objects turning at the same time. 6 of them most of the time.

    But actually I need to use "compare two values" to be able to check the value of the sine (I don't think it's available in the object condition), so my guess is that maybe the correct instance is not selected when I'm asking to check the sine's value.

    In other words, does "compare two values" select only the object instance which conditions are met within it, or doesn't it select anything at all?

    If it selects nothing, any way I could achieve what I want to do (i.e. changing the z-order of the object instance(s) which sine's value is close to their max value)?

  • Hi,

    I'm trying to achieve an effect where a little object will turn around another object (in false 3D). To do this I put an horizontal sine, a slight vertical sine (same period), and Im trying to change the moving object's layer based on the value of the horizontal sine. Here is what my code looks like :

    for an amplitude of 100

    object.sine.value <-99 set object to layer 0

    object.sine.value >99 set object to layer 2

    Of course my other object is on layer 1, so the first one should "turn" around it.

    It seems pretty straightforward but the result is not convincing at all. Actually the moving object often passes 2 times before the other one, sometimes it switches layer in the middle of the movement.

    I also tried to change the layer based on X value of the moving object, but the result is not better.

    Am I missing something with the way sine's value works?

    Thanks in advance!

  • EDIT : adding the "Start animation from beginning" action solves this problem. Just discovered this one.

    Hi,

    I've got a little problem with animations. I've divided my main characters into 17 layers in order to have a customizable character.

    So I created functions to launch the right animation for each layer at the same time. It's working fine BUT for some reason, on certain animations, the current animation can't be interrupted by launching the same animation. In other words, if I launch an animation and launch the same animation while it's running, the first animation will finish, and the second one, triggered while the first one was playing, will not be displayed at all.

    However, all animations can be interrupted by other animation without problems.

    And I double-checked that the "set animation to" actions are always set to "play from the beginning". Any idea of what may cause this?

    Thanks!

  • 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?