Bounce Attack Like in Sonic the hedgehog

I’m looking to create a bounce attack like in sonic the hedgehog when certain conditions are met you can bounce attack on enemies and certain obtacles.
The way I’m planning to do this is:

  • create a variable that detects if its within a certain
    raidus. Then you can bounce attack.

-Bounce attack only happens when you have pressed the jump button along with the button to bounce attack(if that makes sense.

-Then this is where i’m not sure how to implement the feature of moving my character towards the enemy smoothly. Also just like the bounce attack in sonic it is loopable meaning you can bounce attack one enemy then other as along as its within the radius for bounce attack.

I know i might need some sort of array I just need guidance on what i should be looking at and the actual movement of the player towards the enemy is the crucial part the way i see it.


Its been a while since I played Sonic, I will not remember the exact sequence of action from the game, instead I will build my answer from the details you have provided.

I have answered a question on chain attack, it might not be exactly the same, but it is worth taking a look at. I am going to use the same technique from that question and modify it to fit your question.


  1. Create a trigger sphere prefab
  2. Animate the sphere to scale up ( start from 0 to MaximumRange ), so the effect will strike the closest enemy first


Assumption: the attack occurs when you are inAir/isJumpinng and you pressed an attack button (in this example, A-key)

  1. Press jump, character isJumping
  2. Press A, spawn a trigger-sphere
  3. If trigger-sphere hit a destructible-object, send a message to character (search for target, this will make your character hit the nearest target)
  4. Move character towards the destructible-object, (hit)
  5. When character hit the destructible-object, move the character upward (bounce)
  6. If A is still pressed, restart from Step-2

Sample Script

Trigger script

public class TriggerSphere : MonoBehaviour {
   public GameObject character;

   void OnTriggerEnter( Collider other ) {
      if( other.gameObject.CompareTag("CanHit") ) {

         /* Note: A */ 

         character.SendMessage("SetBounceTarget", other.gameObject);

   //Call this using an animation event, just in case the sphere strike nothing at all
   void Kill() {

Character Script

public class Character : MonoBehaviour {
   public TriggerSphere ts;

   private bool isJumping = false;
   private GameObject moveToward;
   void Update() {

      if( isJumping && Input.GetKeyDown(KeyCode.A) && moveToward == null ) {
         TriggerSphere tsClone = Instantiate( ts, transform.position, Quaternion.identity );
         tsClone.character = gameObject;

      if( moveToward != null ) {
         /* Note : B */

   void OnCollisionEnter( Collision collision ) {
      if( collision.gameObject.CompareTag("CanHit") ) {
         isJumping = false;
         /* Note : C */

   void SetBounceTarget( GameObject go ) {
      moveToward = go;  



You need to use a raycast to check there is no obstacle between your character and the destructible-object. You should hit the closest and non-obstructed destructible-object.


Do a calculation on how to move toward a gameobject, you can use Google to assist you


When you have hit a destrutible-object, you will need to return your character back to the jumping-state ( applying force, setting variables to true, etc. Whatever you are using to making your character jump )

Okay thanks I’ve got a perfect bounce attack with no delays now