- Home /
 
               Question by 
               dieente708 · Jul 22, 2020 at 11:09 PM · 
                speedboolpowerupcollectible  
              
 
              Increase the speed after collision
I have this Script:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class movement : EnergyCollection
 {
     public float speed = 3f;
     public Rigidbody2D rb;
     public Animator animator;
 
     Vector2 moveement;
     
     void Update()
     {
         moveement.x = Input.GetAxisRaw("Horizontal");
         moveement.y = Input.GetAxisRaw("Vertical");
 
         animator.SetFloat("Horizontal", moveement.x);
         animator.SetFloat("Vertical", moveement.y);
 
         animator.SetFloat("speed", moveement.sqrMagnitude);
     }
 
     private void FixedUpdate()
     {
         rb.MovePosition(rb.position + moveement * speed * Time.fixedDeltaTime);
     }
 
     void energy()
     {
         if (ennergy == true)
         {
             speed = 10f;
         }
     }
 }
 
When I collide with a object ennergy is set to true But it isnt working im still 3f fast And Ideas^^ thx for all answers :)
               Comment
              
 
               
              How does the energy() function get called? I don't see any references to it in this script.
Your answer
 
 
             Follow this Question
Related Questions
HELP! With my Speed power up 2 Answers
How can I add different amount of stars depending on points reached? 1 Answer
Power Up speed and jump boost 2 Answers
How do I accelerate particles in Shuriken? 1 Answer
How to slow down my spawn rate? 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                