Smileh's Forum Posts

  • Hello

    I'm having an issue with my OnHit function. Basically I want the player to play an animation whenever it gets hit and flash (flash for code purposes mostly, makes it easier).

    My problem is it will play the whole animation even if its finished until the flash is done, which i have set to 1.5 second and I do not want to cut it off.

    Is there any way I can actually make the animation play and end before the flash ends? Otherwise just either loops if I have Loop on Yes or just stands in the last frame if I have set Loop to No.

    Thank you fellas and sorry for the noob queston, a beginer here.

  • To make the knockback I used the set vector x and y.

    On collision with enemy

    If player x < enemy x: set y vector -600 (or use the same value of jump strenght) and set x vector -100 (you should test the best value)

    ELSE : set y vector -600 and x vector 100.

    You also have to work with the animation to set mirrored or not..

    Tried that also, not doing the desired effect I was looking for.

  • Hey there. I'm making a Zelda-like right now and I managed to create a Knockback by using the BULLET function.

    Unfortunately I cannot upload the CAPX as there are many other things in there I worked on.

    Somthing like:

    Player On collision with [Object of Choice] >>> Set Bullet Speed to 400, Set bullet angle to [-angle of player and object]

    Player Bullet Spd > 0 >>> Set Bullet Speed to [ (player bullet speed) - 1000*dt ]

    You can just modify the dt multiplier and bullet speed to determine how much knockback you want.

    Yeah but the knockback would be kinda stiff not really natural for a platformer. Still I will try it. But..

    What do you mean by -angle of player and object, could you make an example?

    Thanks

  • Hello.

    First of all, I've looking at almost every single thread on the forum about knockback and none of them has been useful or fixed my problem so I decided to open a new one and see if I get lucky.

    I'm trying to make my player get knockbacked whenever gets hit by an enemy, kinda like they did in Sonic back in the Mega Drive days, he will get pushed back up in the air.

    I've tried with different events and none of them seems to do the trick for me. Either I need to come up with a good acceleration and some other good values or I'm just using the wrong events. Set platform vector is not working for me. I've tried some Physics also and can't seem to make it wortk either.

    Any suggestions?

  • I dont understand how your 'idle' can play.

    If you do 'as platform is on floor and not moving' set to idle ....

    The two conditions that try to catch that, are always true, unless there is action taken. (an action like moving the player) If you dont use 'once while true', also the idle should not play (unless it is only 1 frame).

    Platform is on floor

    (subevent) Platform is moving - Set Run

    (subevent) Platform is not moving - Set Idle

    Works perfect for me.

  • Nevermind. I think I fixed it!

    Thanks anyway

  • It will be hard to diagnose your issue without seeing your events.

    I have a few ideas for you though. Firstly, if it is a simple flash, you don't need to use an animation, you could just adjust opacity from 0-100 a few times really quick.

    Second, you can use If-Else chains to signify priority. Else events will only run if the previous one did not.

    Else won't do the work for what I've seen from my tests.

    About the opacity won't do the work I really want to play the animation because my character is flubberlike so whenever it takes hit it decompose into small particles and becomes one again. So it is so important to play the takehit animation whenever I call the function takehit.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hello.

    I'm lossing my mind trying to find a fix for this issue. Here's the problem:

    I want to set a "TakeHit" animation whenever I call the funcion TakeHit, which subtracts 1 from HP and sets the player flashing. If I just add the set animation to "takehit" on the function it wont do anything because other animation events are not allowin this to happen.

    Animations events are a few such as platform is on floor and not moving set to idle, if moving set to run. if falling to fall, if jumping to jump and so on.

    I added the condition not flashing to the idle animation events and it worked just for that one but it doesnt work with others.

    Then I tried to add an event like if player is flashing set animation to takehit and it does work but it just plays the frame 0 somehow and it wont play the full animation.

    Is there any possible fix for this?

    Thanks

  • There is a shader effect somewhere, i believe made by "Somebody" that do what you want. Scrolls the image texture of the object.

    Basically let's say I want to make a waterfall but I wan't to have one base waterfall and adjust the height and width of the waterfall as I please. Basically a tiledbackground would allow me to do that, but then I lack the animation.

  • Might try:

    It doesn't work. I need exactly this but I need to play an animation. The only way I found was to use a sprite on top of it but it doesnt seem handy.

    Is there any way?

  • Hello

    I'm making a pixel art platformer and the level one is based on the sewers. I made almost the whole tilemap in which I have a few pipes pouring out dirty water. I want to add an animation kinda like a waterfall falling from the pipe.

    So far I can do it making a sprite and duplicating it along the way until reaching the ground, but I have a feeling is not the way to do it. Tiled background would be the best but you can't load an animation.

    Is there any other way to achieve this effect?

    Thank you!

  • Yes it will spawn the object on the layer that the player is on at the time the event is triggered. player.LayerName is the current layer that the player is on.

    Thanks! So I guess this is a smart way to use this call right? Would you suggest such a thing?

  • Hello fellas.

    So I am going through some capx from assets and engines made by users to learn how they do some stuff and I encountered this code quite a lot.

    Basically when the dev wants to spawn something on the player does this code:

    player is the player box/hitbox.

    Spawn whateveryouwanttospawn on layer player.LayerName(imagepoint 1).

    Excuse me if I sound silly but normally if you use this event you will have to select the layer you want to spawn it but I'm guessing this is some code to use the event in your favour and actually spawn it on the player itself? I'm kinda confused. He does this quite a lot

    Thanks for the help in advance

  • Hello guys,

    I'm trying to learn how to code with C2 and I am looking for complete tutorials if possible with mockups and specially if they're in video format.

    This is a great example of what I am looking for:

    https://www.youtube.com/playlist?list=P ... 0ewHjdE20e

    Would appreciate if they were on the same level of knowledge since this series has been kinda hard for me with a few functions and instance variables.

    Thank you!

  • Not really need to do this but I'd like to know how to do it as well, might come handy.

    Good question.