using UnityEngine;
using System.Collections;
public class PlayerHealth : MonoBehaviour {
public int maxHealth = 100;
public int curHealth = 100;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI(){
GUI.Box(new Rect (10, 10, Screen.width / 2 / (maxHealth / curHealth), 20) curHealth + "/" maxHealth);
}
}
@badassgamer I don’t want you to take this the wrong way, but 90% of your threads could be solved by just gaining some general programming knowledge. And the only way to gain that is to try solving things yourself.
The errors you get are extremely helpful. They tell you exactly where to look to fix the problem. If you don’t know what the messages mean, Google that message (In this case, “unexpected symbol”) and then look at the line and column where it’s saying it happened and attempt to solve it.
I’m assuming most of these scripts you’re posting are adapted from stuff you’ve found elsewhere. Which is fine. But if you just keep posting your issues and having others tell you how to fix it, you’ll never actually learn how to write your own code.
llol no problem . i understand what your saying but i cant slove myself cause it is so hard . i dont even understand what each line does . so at the end i give up and start just typing the code that they type on tutorial videos and leave it. yes i know i should something about it. thats what thinking . if i still cant learn then i should move to visual scripting . unity3d does not has it and also i cant buy playmaker and so i either need to move to ue4 cause it has visual scripting. but if you want say something just say it cause i dont get anything wrong.i know you people are helping me . thank you for it
Again… this is going to sound harsh… but if you believe learning code is too hard, you don’t have much of a chance at success at making a game. And it doesn’t even sound like it would be the enjoyable of a hobby, even. Making games isn’t easy, and a lot of times, it’s not even fun!
Programming is just another language. You’ve mentioned English isn’t your native language. You’ve picked it up fairly well, though, and English is a tough language to learn. A programming language is no different.
Look for C# tutorials. I found this one by searching for “learn C# free online”. You have to give it time, though, and don’t give up because you ran into one thing you can’t figure out. Programmers get paid well because we run into things every single day we can’t figure out… and then we figure them out.
I’ve never tried visual scripting, but I find it hard to believe any decent game has been made using it. C# itself is an abstraction of code execution… any further away and you might as well use GameSalad or something…
Work through these, they let you download the assets so you can watch the videos where they explain what they’re doing & why & then you can do it on your own computer. Take your time, as you learn new things go back to the old ones you’ve finished & try to make small changes. That way you are starting with something that worked so if it stops working you will know the problem is in the new bit you added.
A visual scripting language is still a programming language but with a slightly different form. The fundamental concepts will be the same. You have variables, branching commands (if, switch, etc), loops (do, for, etc), and so on. You’re simply switching from lines of text to symbols wired together.
If I recall correctly there was at least one project mentioned during the early days of Unreal 4, but I can’t be bothered to dig around too heavily. I’m confident it is entirely feasible to do so as they’ve been progressively unlocking more and more of the APIs for use in Blueprint.