miguel-romm's Forum Posts

  • Hello, mates!

    Which would be the best way to implement a swipe gesture to change the position and gravity of a sprite?

    I want to make it by tracking the speed of the gesture depending on the finger movement (fast/abrupt or slow/smooth). It would be like a drag and drop only the Y-axis, but making the swipe on any region of the screen.

    Swipe up: Sprite above the rectangle.

    Swipe down: Sprite below the rectangle.

    And the idea is that the sprite would make a little jump on the start of the swipe and before it would go behind the rectangle (and the same but in reverse when swipping up).

    This is a sketch to understand my question:

    i.imgur.com/TAfyJXH.png

    Thank you in advance!

  • Didn't I answer this question in another post? :)

    Anyway, here is another way to do this - instead of distances in pixels use angles. For example, small ship "width" is 5 degrees, big ship "width" is 30 degrees, distance between them should be 5-15 degrees etc.

    Here is a demo:

    https://www.dropbox.com/s/3pycm5l1lbnm85w/CircularSpawn.capx?dl=0

    Yes, you answered me, but I didn’t understand how to do it well and I asked you about, but I haven’t received more answers from anybody, so I created this post to see another possibilities to make it : /

    I will try with that method using angles for the separations. It seems that could work nicely. Again, thank you so much for your help, dop2000! :)

  • Hello, mates!

    i.imgur.com/waGpqja.png

    This sketch is basically the idea I have, but I lack a very important detail to do.

    How could I define a range of minimum and maximum distance between the different sprites (family: 1, 2, 3) at the time of being generated "procedurally" (using that range)?

    Thank you so much!

  • This is a bit tricky..

    You can generate the size of the next sprite in advance. Say, you're spawning sprite #1 (small), and at the same moment you randomly choose the size of sprite #2 (which will be created next) and save it in some variable.

    Let's say sprite #2 will also be small. Since you know that current sprite and next sprite are both small, you can use Timer behavior to schedule next spawn event in 1 second. If next sprites is big, you increase the delay and spawn it in 2 seconds. If both current and next sprites are big - in 3 seconds. This way the distance between sprites of different size will be roughly the same.

    This was just off the top of my head, there may be other solutions.

    Mmmm, sounds interesting... Could you do me the favor of explaining it with some capture of Construct or something more visual? I’m a newbie and I’m not a programmer, so it’s a little bit difficult for me to understand some concepts. I would really appreciate it.

    Thank you, dop2000!

  • Just set the correct angle before pinning. You can try "Set angle towards GreenSprite" and then "Rotate 90 degrees counterclockwise".

    Or "Set angle to (angle(Self.x, Self.y, GreenSprite.x, GreenSprite.y)-90)"

    Thank you so much, dop2000! Now it works.

    And for the distance point:

    How could I define a range of minimum and maximum distance between the different sprites at the time of being generated "randomly" (using that range)?

  • Hi, you all!

    I have different sprites inside a Family and my idea is to generating them endlessly, in a random order (with different distances between one and another for each new instance of them) and following and "invisible curve path".

    Here I let you a pair of sketches I made to understand it much better.

    I want to create something like this:

    i.imgur.com/waGpqja.png

    But this is what I'm getting until now:

    i.imgur.com/I92SfP6.png

    I have managed to create the endlessly generation of the sprites, but with the same distance between them, and I pinned them to an invisible point (like the green circle of the pictures) which is rotating counter-clockwise, but the result is the second image scene...

    So I want to know the best way to do it, because the angle of the sprites it's not mantaining the circular "path" and the distance between all of them is always the same.

    Thank you in advance!

  • you could create your own double tap function, but that would lead to delays.

    A better solution would be to place a button on the UI to jump or switch. Or you use a swipe to change the character.

    PS: C2 has no 'Timer is running' event. Use systems compare two values: Player.Timer.CurrentTime("DoubleTap") < Player.Timer.Duration("DoubleTap")

    Thank you, kriand. I will test that solution. I hope it will work in my case or gives me a clue at least.

  • Yes, all objects are touched/clicked regardless of the Z-order, even if they are invisible. You can put all UI elements into a family and create your event like this:

    + Touch: On tap gesture

    + Touch: [X] Is touching Fam_UI

    -> Sprite: Simulate Platform pressing Jump

    But i dont know what you mean by changing characters.

    Thank you, kriand! I will test it later.

    Sorry, I forgot to mention that I want to alternate between two characters of the game with a double tap on the screen. That's what I meant by "changing characters".

  • Hi you all!

    I've set an action when the player touches any area of the screen (character jumping), but I don't want to activate this action when an UI button is touched. I only want to activate the button action in that specific case ("one tap object" / "one touched object" doesn't work :S). How could do I this correctly? I thought Construct 2 respected the Z order when you touch or make click on the UI or another element of the screen which are below or above in the z order or in different layers.

    And if the characters jump when any region of the screen is touched (one tap), how do I to assign a double tap to change between the characters without conflicts with the number of taps?

    Thank you!

  • Miguel Romo check again it's there File Name: Demo Example

    Thank you for your help, Lordshiva1948. I'm checking your modified file, but it still having bugs. Is it that complicated to make it work? It seems to be harder than I thought...

    Update:

    It seems that I finally got it, although the characters change their positions when I touch the button to make them appear/disappear and that causes some "oddities" in the game...

    And the problem with jumps persist. I've set an action when the player touches any area of the screen, but I don't want to activate this action when an UI button is touched. I only want to activate the button action. How could do this correctly? I thought Construct 2 respected the Z order when you touch or make click on the UI or another element of the screen.

    If the characters jump when any region of the screen is touched (one tap), how could I do to assign a double tap to change between the characters without conflicts with the number of taps?

  • Miguel Romo I have corrected your CAPX you can download from

    my dropbox file name Demo Example.capx

    cgpatel.co.uk

    or check your code

    Thank you for your time, Lordshiva1948, but I can't find the file you mention in your Dropbox directory.

  • Thank you for your answers, Maverick1912 and Killax11. I really appreciate it.

    Maverick1912, here is the concept I'm working at: https://mega.nz/#!IVFGQYwD!iuOq3rM3i2Qt4NDXOPoO7uMfk3Vp2DxZoSWbEXLtdYk

    I'm a begginer and I think is so easy, but I don't understand why it's failing trying it using the methods that Killax11 have mentioned... I've tried these past days all of that ways to make it work, but there is always a problem.

    And the problem with the touches on the button, which makes characters to jump is so annoying too. How can I solve it? (the invisible sprite I created for a "jumping activator" doesn't work).

    I hope you can help me! Thank you!

  • Hello, mates.

    What's the best way to do a toggle button? The methods I've tried these past days doesn't seem to work and it's so annoying...

    I want this:

    · In the scene, there is a character.

    · If the player touches the button > The sprite (state) of the button change, the actual character dissapear and appear another at the same position of the initial character.

    · When the player touch the button again, it's the same process, but the other way around. So the button have two states and there are two characters to alternate.

    · There are two classes of objects during the game. Character A can collect only object A and character B, only object B.

    What's the best way to do this? I'm confused, because I don't understand why my methods have failed.

    Also, another simple doubt:

    I've set an action when the player touches any area of the screen, but I don't want to activate this action when an UI button is touched. I only want to activate the button action. How could do this correctly?

    Thank you for your help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If the path is circular, as on your picture, it's easy. You can pin the platform to another sprite (pivot point) and rotate that sprite.

    If needed, change the Platform angle of gravity as well.

    Thank you, dop2000! I will try it

    I would like to know what’s the best way to make a path the platforms move along it.

    This path would have a curved form and the platforms and rest of elements should follow its angle.

    This’s a quick sketch I made to understand my question better:

    Thank you!