Temporary Powerups in Unity

  Рет қаралды 4,402

ACDev

ACDev

Күн бұрын

I had to make a tutorial video for one of my beginning programmer courses, so I decided to upload here as well: this one's a beginner tutorial to help you add powerups to your game. We'll learn the basics of doing something 'over time' with Coroutines and touch on a few visual flairs to emphasize our powerup effects!
00:00 - Intro
01:46 - Powerup GameObject
03:24 - Powerup Script
08:00 - Powerup Sequence
11:07 - Faked Disable
15:36 - Affecting Player
19:58 - Ship Booster
27:46 - Powerup Burst
31:57 - Conclusion

Пікірлер: 16
@Rirage
@Rirage Жыл бұрын
Wow! Wow! Wow! This is what I have been looking for. Thanks a lot.
@AZREALSIN
@AZREALSIN 2 жыл бұрын
hi, I just wanted to thank you for this video! it's so clear and explained very well. Also helped me create a slow down powerup!
@aaron4488
@aaron4488 8 ай бұрын
Very well explained. Good walk through
@SekyoT
@SekyoT Жыл бұрын
Thank you so much, for so much code this is surprisingly easy to understand thanks to your explanations. I was looking for so many videos thanks man you saved my project
@lukeydzbecx8319
@lukeydzbecx8319 6 ай бұрын
Sensational work
@terencerixon3050
@terencerixon3050 2 жыл бұрын
Another great video.
@jean-michel.houbre
@jean-michel.houbre 2 жыл бұрын
Très clair et intéressant. Merci beaucoup.
@robbybobbijoe
@robbybobbijoe Жыл бұрын
Managed to make this in my 1v1 game, where each player have their own movement script so instead I made 2 new Powerup scripts for each players referencing their own movement script to add the speed value. I'm a newbie to coding so I hope my explanation was good. Had to change a great deal in my speedpowerup script too, posting it so anyone can see for fun: using System; using System.Collections; using System.Collections.Generic; using UnityEngine; [RequireComponent(typeof(Collider))] public class SpeedPowerup : MonoBehaviour { [SerializeField] private float _speedIncreaseAmount = 5; [SerializeField] private float _powerUpDuration = 3; [SerializeField] private GameObject _artToDisable = null; private Collider _collider; private void Awake() { _collider = GetComponent(); } private void OnTriggerEnter(Collider other) { Powerups player = other.gameObject.GetComponent(); PowerupsTwo player2 = other.gameObject.GetComponent(); if (player != null || player2 != null) { StartCoroutine(PowerUpSequence(player, player2)); } } public IEnumerator PowerUpSequence(Powerups player, PowerupsTwo player2) { _collider.enabled = false; _artToDisable.SetActive(false); if (player != null) { ActivatePowerup(player); yield return new WaitForSeconds(_powerUpDuration); DeactivatePowerup(player); } else if (player2 != null) { ActivatePowerup(player2); yield return new WaitForSeconds(_powerUpDuration); DeactivatePowerup(player2); } Destroy(gameObject); // or re-enable with setactive } private void ActivatePowerup(Powerups player) { if (player != null) { player.AddMoveSpeed(_speedIncreaseAmount); player.SetBoosters(true); } } private void DeactivatePowerup(Powerups player) { if (player != null) { player.AddMoveSpeed(-_speedIncreaseAmount); player.SetBoosters(false); } } private void ActivatePowerup(PowerupsTwo player) { if (player != null) { player.AddMoveSpeed(_speedIncreaseAmount); player.SetBoosters(true); } } private void DeactivatePowerup(PowerupsTwo player) { if (player != null) { player.AddMoveSpeed(-_speedIncreaseAmount); player.SetBoosters(false); } } }
@mogumogu1795
@mogumogu1795 2 жыл бұрын
Thanks for the tutorial dude I really nees this tutorial for my first game
@wiseman9446
@wiseman9446 Жыл бұрын
Thankyou So Much Sir
@HellTraveler
@HellTraveler 5 ай бұрын
thanks alot for this ! also I'm trying to figure out a way to lose the power up effects if I enter the kill zone. For example if I collide with the kill zone while having the power up effect I want the "jumpForce" to go back its default value of 10f, and destroy the game object. In this case the power up gives me +10f of "jumpForce" for 2f seconds then it loses the 10f. The Kill Zone just Transforms the position of the player.
@yummybunny7351
@yummybunny7351 2 жыл бұрын
Good video. But I think, at 16:50 should be not "Set", but "Add" speed. And it usually recommended cash "new WaitForSeconds".
@acdev7027
@acdev7027 2 жыл бұрын
Yeah, right when I saw what I had named the Speed change I realized that it was slightly different than what I was doing, I just couldn't think of the better name on the spot. I agree, AddMoveSpeed() would have been much more accurate!
@MarekNijaki
@MarekNijaki 2 жыл бұрын
For channel growth
@ufukozkan570
@ufukozkan570 2 жыл бұрын
For channel growth ..
@uso2484
@uso2484 2 жыл бұрын
Comment for channel providing
⚡ Всё про события в Unity 3D
21:38
Emerald Powder
Рет қаралды 103 М.
2D PATHFINDING - Enemy AI in Unity
23:13
Brackeys
Рет қаралды 807 М.
Heartwarming moment as priest rescues ceremony with kindness #shorts
00:33
Fabiosa Best Lifehacks
Рет қаралды 38 МЛН
Best father #shorts by Secret Vlog
00:18
Secret Vlog
Рет қаралды 22 МЛН
Little girl's dream of a giant teddy bear is about to come true #shorts
00:32
Collect Items in Unity  -  Game Dev Tutorial
17:11
Lost Relic Games
Рет қаралды 29 М.
A Great Way To Setup POWERUPS In Your Unity Game
13:43
How to make Snake in Unity (Complete Tutorial) 🐍🍎
47:24
Zigurous
Рет қаралды 183 М.
Flexible LOOT SYSTEM in Unity with Random Drop Rates
13:24
Adobe is horrible. So I tried the alternative
25:30
Bog
Рет қаралды 718 М.
Crowdstruck (Windows Outage) - Computerphile
14:42
Computerphile
Рет қаралды 122 М.
How to Make a Buff/Debuff System with Unity ECS - [ECS Ver. 0.50]
33:02
Turbo Makes Games
Рет қаралды 10 М.
POWER UPS in Unity
10:54
Brackeys
Рет қаралды 302 М.
FULL PICK UP & DROP SYSTEM for WEAPONS or ITEMS || Unity3d Tutorial
5:45
Dave / GameDevelopment
Рет қаралды 181 М.
EASY Unity Character Speed Boost | Unity Guide | FAST
6:11
KeySmash Studios
Рет қаралды 23 М.
Heartwarming moment as priest rescues ceremony with kindness #shorts
00:33
Fabiosa Best Lifehacks
Рет қаралды 38 МЛН