Push Back - A Better Way ???

0 favourites
  • 6 posts
From the Asset Store
Helping streamers give their viewers more excitement.
  • Hello All,

    So I'm working on my basic Platformer (my very first game in Construct 3 as I'm learning).

    I'll try to explain what I did so maybe you can help me out here.

    This is what I got for the Player:

    I used a Box as the actual Player with the Platform behaviour

    The Animated Sprite is attached to this Player Collision Box with all animations:

    Idle, walk, jump, punch (attack) so far everything works great!

    For the Enemy:

    Platform behaviour, walks Right & Left and Mirror for the right direction when collide with the wall (solid).

    For the Player Attack I made this:

    • When pressing the 'SPACE' key, The player play the "Attack" animation.
    • Player create a Red-Box (invisible collision, plays for 2 frames real fast).
    • When the Red-Box collision with the Enemy, the Red-Box destroyed and this is where the Push Back should happen!

    PUSH BACK:

    This is what I did in general, I used 2 ways:

    1

    - I used vector X and Y (for how far and how high the enemy will push back)

    it worked PERFECT before I added movement (platform) for the enemy.

    As soon as I added the Platform movement (playing with the properties, speed and acceleration) I had weird results... bad distance, mirroring and more randomness.

    2

    - I wanted to try different SIMPLE way, I added a Bullet Behaviour so it will be enabled for 0.2 seconds and Disable itself, but it wasn't act smooth as the Vector X way and also it acted weird and random the mirroring.

    Considering I'm still a newbie in Construct and learning, I tried these ways but I still have much more to learn.

    Now... forget about my "ways" of what I did for the push back.

    What do YOU recommend for a smooth looking push back for enemy?

    The most important for me is that the Enemy will push back from the opposite side of the punch (player.X)

    I believe that either Vector X or Bullet (enable/disable) are the solutions BUT do you have other idea or something you already did before and you can share with me?

    I'm not even sure if I'll understand, so if you have a video tutorial or example to share it will be great visual for me to explore it.

    Thanks ahead! and sorry about my bad English.

    Early example of my noob-journey.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi!

    I have had your very same problem in the past and even tried solutions very similar to what you describe. Unfortunately those solutions never gave me the smooth push back I was looking for.

    Then I discovered Rex's "Move To" add on for C3. Probably one of the most useful add-ons for my purposes and I think it will solve your push back problem well. Basically you can tell any object to move relative to it's location and specify the speed at which it can move. There is a lot more things you can do with it as well, but the basic 'Move To' behavior is super useful in itself.

    You can find it in this thread:

    I hope that helps!

  • Thank you so much!

    I should try use it and probably some other REX Addons for C3 may make things easier!

  • Update:

    I'm trying to mess with it but still, I get the same weird results I described above when I tried the Vector X.

    I'm pretty sure that I over-do the code while it's probably could be much simple to accomplish.

    it's probably because I'm still learning Construct as I experiment.

    If anyone can make an example capx of with or without the "Move To" behaviour:

    (the cleanest shortest code, the better)

    • Push-Back the enemy
    • After the Enemy pushed and stopped, Enemy Waits for 0.25 seconds
    • Then the Enemy continue walking to Right or Left (could use Choose I guess) but he must be mirrored.

    Thanks ahead for any help!

  • Alon,

    please upload your capx so that we can improve it much faster.

  • Alon,

    please upload your capx so that we can improve it much faster.

    Drago_18 ReillyRobbie and everybody else who wants to help

    I made a much more simple base experimental file from scratch so you can play with and maybe help me out to make a smooth Push / Knock Back for the Player.

    I did my best to keep everything very clean and organized but please remember, I'm a noob so I may code things in the wrong way. I hope it's still possible to work with.

    I disabled some code I didn't use or finish so please ignore it.

    What you'll see for the Push / Knock Back I did so far was OVER complicated, I'm sure it can be done in a much simple way but again, I'm just a noob.

    You'll notice that I barely use variables at all, I think it can be done in many other ways so I kept room for you to play with it.

    So if any of YOU can do the same "idea" for a smoother result with or without "Move To" Behaviour by REX, it will be really great to share here so me and others can see what you did and how clean it is compare to my MESS... (sorry for the ugly simple graphics as well, I made it fast for sake the of experiment).

    Thanks ahead for anyone who helps in this, I'm curious to see your ways.

    My Experimental .capx for download:

    https://goo.gl/e1x8FS

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)