How to make javascripts

Hi guys, Im pretty new to the programming side of game development, and although I know java code and stuff like that, I don’t really know how to implement this into a game and what commands are used in game development (not sure if commands is the right word, statements, stuff like that). So I was wondering if you guys knew any tutorials or guides oh how to code java for a game.
If you don’t get what I mean, heres an example. So lets say Im programming minecraft, and I want to use an if statement for if a zombie is within 3 squares of the player they can take off 1 heart. I can’t simply write
if (zombie within 3 squares) {
take off 1 heart from player
}

So what commands from the game development side of java are there for me to use?

Thanks, and if your confused in any way of what Im talking about just say
Tom

Let’s make this clear. Javascript is NOT Java. Never get them mixed up. EVER.

I’m done.

If you want to learn programming, get to your local library, and get a book on it. Spend a long time getting to understand how code works. Maths skills help.

Unity comes with a choice of scripting languages: UnityScript (JavaScript), C#, and Boo (like Python). There is documentation for all of the classes, in each language. There is also a multitude of tutorials all over the internet to help you get to grips with it.

There’s no easy way. You just have to get stuck in.

No I actually know coding, I know java, but the course I did wasn’t specific to games, but just normal java course, I just need to know how to implement this knowledge into game coding and what the extra commands and statements that are specific to making games/unity are?

For the last time. you don’t need Java for Unity. JavaScript and Java are entirely different.

As I said, if you read my post, Unity comes with a rather handy scripting documentation, with examples. Use it.

Also unity uses UnityScript which is like javascript but not exactly it, but just go look at the Script Reference for the documention, and theres tons of tutorials around the internet for Unity, Google <3

So do I need to learn JavaScript or UnityScript?

UnityScript is Unity JavaScript. Exact same syntax.

I know this is entirely counter-intuitive, but if you already know Java, you’ll probably find C# much closer to what you know than Unityscript. I’m reminded of someone (I think it was Dreamora) that used to often quip that he wished Unity had never called it Javascript. I’m inclined to agree.

I personally prefer C# only sense it makes working with other code from the asset store much easier, and auto complete !

Any good links to start learning from?

Yeh I wish they didn’t call it java script, the whole reason I took that course is for game making lol, I might give C(hashtag- I don’t have the key for it) a go, any good links to begin from?

Acually, I learned Java and javascript IS similar. If you know Java Javascript is a bit different but wouldn’t say a whole new lanuage.

Yes as fish man pointed out Java scripts are not Java scripts. They are just called java scripts because they have a similar syntax and calling them java sounded better than calling them Unity scripts I guess. Also Hyenas aren’t dogs, they are closer in relation to felines.

It’s really not like Javascript at all, and has quite different syntax. It’s a lot more like ActionScript 3.

Only in the sense that they are curly-brace languages; other than that they are not particularly similar. As mentioned, Java and C# are quite a bit more similar than Java and Javascript.

–Eric

check out my signature

Or the bottom section of mine