a4anarchy
Skip

Digitalmagicians Game Developers Discussion Board

    Post has published by digitalmagicians
    Viewing 2 posts - 1 through 2 (of 2 total)
    • Keymaster
      Member since: September 27, 2022

      How to make a brawl stars game

      I actually am working to make a brawl stars based clone with a little twist. MOBA game have been an elusive subject for game development on the web for me so I thought we can build a forum around this topic. We will go through this step by step in how to make a brawl stars game but let start with the simple stuff needed for the game The character movement scripts. So in Brawl Stars, this is a top down isometric shooter base so the controls should be simple. But I’m quickly learning this is not the case. The scripts I came up with for movement is as followed:

      Best place I saw for this resource to understand better is Coding Jedi YouTube channel. Shout out for this tutorial.

       

      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;

      public class PlayerMovement : MonoBehaviour
      {

      [SerializeField]
      Joystick joystick;

      [SerializeField]
      Transform PlayerSprite;

      [SerializeField]
      Animator animator;

      public float speed;

      public bool Movement;

      // Start is called before the first frame update
      void Start()
      {
      speed = speed;
      }

      // Update is called once per frame
      void FixedUpdate()
      {

      if (joystick.Horizontal > 0 || joystick.Horizontal < 0 || joystick.Vertical > 0 || joystick.Vertical < 0)
      {
      if(PlayerSprite.gameObject.activeInHierarchy == false)
      {
      PlayerSprite.gameObject.SetActive(true);
      }

      PlayerSprite.position = new Vector3(joystick.Horizontal + transform.position.x, 0f , joystick.Vertical + transform.position.z);

      transform.LookAt(new Vector3(PlayerSprite.position.x, 0, PlayerSprite.position.z));

      transform.eulerAngles = new Vector3(0, transform.eulerAngles.y, 0);

      transform.Translate(Vector3.forward * speed * Time.deltaTime);

      if(animator.GetBool(“running”) != true)
      {
      animator.SetBool(“running”, true);
      animator.SetFloat(“runSpeed”, speed);
      }

      Movement = true;
      }
      else if(Movement == true)
      {
      PlayerSprite.gameObject.SetActive(false);

      animator.SetBool(“running”, false);

      Movement = false;
      }
      }
      }

       

      Anyone looking to develop a project like this we can all share to help get each others projects off the ground. You can check out our upcoming game and get details as we develop it. A for Anarchy.

    • Keymaster
      Member since: September 27, 2022

      A simple script if your game is more simple below

      using UnityEngine;

      public class AttackTarget : MonoBehaviour
      {
      public int health = 100;

      public GameObject attackTrailEffect;

      public void TakeDamage(int damageAmount)
      {
      health -= damageAmount;

      if (health <= 0) { Die(); } } void Die() { // Play death animation and sound Destroy(gameObject); } void OnTriggerEnter(Collider other) { if (other.CompareTag("Player")) { TakeDamage(10); // Set damage amount as needed // Spawn attack trail effect Instantiate(attackTrailEffect, transform.position, transform.rotation); // Play attack sound effect // (insert code for playing sound effect here) } } }

    Viewing 2 posts - 1 through 2 (of 2 total)

    You must be logged in to reply to this topic.

    Facebook X / Twitter Pinterest reddit Amazon
    A password will be emailed to you.
    Liked!
    Disliked!