Hey ! I’m creating a bounce attack feature like in sonic the hedgehog in which you can bounce attack one enemy and then another so looping through an array enemies.
So far I’ve got the bounce attack working for when it targets just one enemy without it looping.
However I’ve tried to implement a loop for the bounce attack to attack a loop of enemies
eg// target first closest enemy then the next closest etc.
But nothing actually happens no errors at all and it doesn’t target the closest enemy let alone the next .
I want to use loop rather than a ontrigger because i’m going to use the ontrigger for when the bounce attack collider with a sphere collider that spawns when enemy is in distance. Just in case your wondering.
Heres the code below for you to have an idea edited version of code i took out the array and i’m going to start looking at the answers you’ve provided :
function BounceAttack()
{
var controller : CharacterController = GetComponent(CharacterController);
var distance = Vector3.Distance(target.position,transform.position);
if( jumpSpeed==70.0 && !controller.isGrounded )// if the jump speed if 70.0 and its not
// colliding with anything or not on the ground
{
if(Input.GetButton("Fire2") && gravity ==90.0 && distance
Yes it really does help thanks !! i'm just looking to get my head around switch statements i haven't coded switch statements in a while
– Charles_Gams