In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "how to achieve shooting Mini Game Unity", the content is easy to understand, clear, hope to help you solve their doubts, the following let the editor lead you to study and learn "how to achieve Unity shooting Mini Game" this article.
Game screen display
This Mini Game only uses two UI interfaces, one is menu interface, the other is combat interface.
There are three modes of menu interface, which are general, difficult and hell.
The battle interface is very simple to brush wild monsters from both sides, and then the protagonist shoots them.
UI construction is very simple, only a background image using Image, plus a Text text input box, and then put the location!
The menu interface is as follows
Battle screen demonstration
Analysis of game code
This horizontal version of 2D shooting Mini Game, the core part only needs two scripts to complete, as soon as you learn, let's take a look at the code!
A script PlayerMove mounted to the player to control the player's left and right movements and jumps
There are two other ways to shoot, one is penetration and the other is slam! When you encounter a monster, you will lose blood.
When the player's blood volume is less than 0, it will jump out of the screen at the end of the game, very simple and clear logic!
The code is as follows, one does not have many lines, and the content of the code is also the most basic knowledge point of Unity. I believe anyone who knows a little can understand it.
The PlayerMove code is as follows
Using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class PlayerMove: MonoBehaviour {/ Health / public int HP; public Slider hpUI; / Animation / public Animator _ animator; / Kill / public static int jisha; public Text jishaUI; public Text jishaUIEnd / whether to jump / public bool isJump; / Game over UI / public GameObject ui; / / Use this for initialization void Start () {Time.timeScale = 1; jisha = 0; hpUI.maxValue = HP; hpUI.value = HP } / / Update is called once per frame void Update () {if (Input.GetKeyDown (KeyCode.Escape)) {UnityEngine.SceneManagement.SceneManager.LoadScene ("Menu");} if (HP
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.