d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Programing! > Topic.
Add Reply New Topic New Poll
Member
Posts: 8,370
Joined: Jan 4 2011
Gold: 100.00
Nov 27 2013 09:01pm
Where did you guys start?
What do you know?

I know some C, C# C++.
Java. JS
and VB lol.

I'm currently trying to learn some pearl or something haven't fully decided.
I started with VB pulling programs apart and learning how they worked after making a few VB projects I moved on. did Java at college ect.

Oh and I know some PHP but not much haha.

I'm currently working in UNITY using the JS it's interesting how it's like its own langue within Java.

Example:

Code


#pragma strict

var bulletPrefab : Transform;
var player : GameObject;
var force : float = 2000;
var shootForce : float = 1000;

function Update () {
if(Input.GetMouseButtonDown(0)){
//fire bullet

fire();

//audio clip
}
}

function fire(){
var instanceBullet = Instantiate(bulletPrefab,transform.position,Quaternion.identity);
instanceBullet.rigidbody.AddForce(transform.forward*shootForce);
}


Basic idea on Unity how to make an object 'fire' via JS.

Here is a slightly more advanced one - Btw these are just straight from the unity forum from users:

Code
var range = 100.0;
var fireRate = 0.05;
var force = 10.0;
var damage = 5.0;
5.var bulletsPerClip = 40;
var clips = 20;
var reloadTime = 0.5;
var hitParticles : ParticleEmitter;
var muzzleFlash : Renderer;
10.var noClips = false;
var BloodEmitter: GameObject;

private var bulletsLeft : int = 0;
private var nextFireTime = 0.0;
15.private var m_LastFrameShot = -1;

function Start () {
hitParticles = GetComponentInChildren(ParticleEmitter);

20.// We don't want to emit particles all the time, only when we hit something.
if (hitParticles)
hitParticles.emit = false;
bulletsLeft = bulletsPerClip;
}
25.
function LateUpdate() {
pickup();
if (muzzleFlash) {
// We shot this frame, enable the muzzle flash
30.if (m_LastFrameShot == Time.frameCount) {
muzzleFlash.enabled = true;

if (audio) {
if (!audio.isPlaying)
35.audio.Play();
audio.loop = true;
}
} else {
// We didn't, disable the muzzle flash
40.muzzleFlash.enabled = false;
enabled = false;

// Play sound
if (audio)
45.{
audio.loop = false;
}
}
}
50.}

function Fire () {
if (noClips == false){
if (bulletsLeft == 0)
55.return;

// If there is more than one bullet between the last and this frame
// Reset the nextFireTime
if (Time.time - fireRate > nextFireTime)
60.nextFireTime = Time.time - Time.deltaTime;

// Keep firing until we used up the fire time
while( nextFireTime < Time.time && bulletsLeft != 0) {
FireOneShot();
65.nextFireTime += fireRate;
}
}
}

70.function FireOneShot () {
var direction = transform.TransformDirection(Vector3.forward);
var hit : RaycastHit;

// Did we hit anything?
75.if (Physics.Raycast (transform.position, direction, hit, range)) {
// Apply a force to the rigidbody we hit
if (hit.rigidbody)
hit.rigidbody.AddForceAtPosition(force * direction, hit.point);

80.// Place the particle system for spawing out of place where we hit the surface!
// And spawn a couple of particles
if (hitParticles) {
hitParticles.transform.position = hit.point;
hitParticles.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
85.hitParticles.Emit();
}

// Send a damage message to the hit object
hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);
90.}

bulletsLeft--;

// Register that we shot this frame,
95.// so that the LateUpdate function enabled the muzzleflash renderer for one frame
m_LastFrameShot = Time.frameCount;
enabled = true;

// Reload gun in reload Time
100.if (bulletsLeft == 0)
Reload();
}

function Reload () {
105.
// Wait for reload time first - then add more bullets!
yield WaitForSeconds(reloadTime);

// We have a clip left reload
110.clips--;
bulletsLeft = bulletsPerClip;
}

function GetBulletsLeft () {
115.return bulletsLeft;
}

function Update (){
if (clips == 0){
120.print("get Ammo");
noClips = true;
}
}

125.function pickup(){
}


\e What do you guys do with your programming? :)

This post was edited by Incisions on Nov 27 2013 09:02pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 27 2013 09:07pm
you gonna start a blog here like Eep did?

i dont know a whole lot, but it's enough to get by.
Member
Posts: 8,370
Joined: Jan 4 2011
Gold: 100.00
Nov 27 2013 09:11pm
Quote (carteblanche @ Nov 28 2013 02:07pm)
you gonna start a blog here like Eep did?

i dont know a whole lot, but it's enough to get by.


No, not a blog just curious to what people know and what they don't and what they like to do or make :)
Member
Posts: 11,610
Joined: Oct 28 2008
Gold: 1,795.00
Nov 27 2013 09:49pm
Quote (Incisions @ Nov 27 2013 09:01pm)
Where did you guys start?
What do you know?

I know some C, C# C++.
Java. JS
and VB lol.

I'm currently trying to learn some pearl or something haven't fully decided.
I started with VB pulling programs apart and learning how they worked after making a few VB projects I moved on. did Java at college ect.

Oh and I know some PHP but not much haha.

I'm currently working in UNITY using the JS it's interesting how it's like its own langue within Java.

Example:

Code
#pragma strict

var bulletPrefab : Transform;
var player : GameObject;
var force : float = 2000;
var shootForce : float = 1000;

function Update () {
    if(Input.GetMouseButtonDown(0)){
        //fire bullet 

        fire();

        //audio clip
    }
}

function fire(){
    var instanceBullet = Instantiate(bulletPrefab,transform.position,Quaternion.identity);
        instanceBullet.rigidbody.AddForce(transform.forward*shootForce);
}


Basic idea on Unity how to make an object 'fire' via JS.

Here is a slightly more advanced one - Btw these are just straight from the unity forum from users:

Code
var range = 100.0;
var fireRate = 0.05;
var force = 10.0;
var damage = 5.0;
5.var bulletsPerClip = 40;
var clips = 20;
var reloadTime = 0.5;
var hitParticles : ParticleEmitter;
var muzzleFlash : Renderer;
10.var noClips = false;
var BloodEmitter: GameObject;

private var bulletsLeft : int = 0;
private var nextFireTime = 0.0;
15.private var m_LastFrameShot = -1;

function Start () {
hitParticles = GetComponentInChildren(ParticleEmitter);

20.// We don't want to emit particles all the time, only when we hit something.
if (hitParticles)
hitParticles.emit = false;
bulletsLeft = bulletsPerClip;
}
25.
function LateUpdate() {
pickup();
if (muzzleFlash) {
// We shot this frame, enable the muzzle flash
30.if (m_LastFrameShot == Time.frameCount) {
muzzleFlash.enabled = true;

if (audio) {
if (!audio.isPlaying)
35.audio.Play();
audio.loop = true;
}
} else {
// We didn't, disable the muzzle flash
40.muzzleFlash.enabled = false;
enabled = false;

// Play sound
if (audio)
45.{
audio.loop = false;
}
}
}
50.}

function Fire () {
if (noClips == false){
if (bulletsLeft == 0)
55.return;

// If there is more than one bullet between the last and this frame
// Reset the nextFireTime
if (Time.time - fireRate > nextFireTime)
60.nextFireTime = Time.time - Time.deltaTime;

// Keep firing until we used up the fire time
while( nextFireTime < Time.time && bulletsLeft != 0) {
FireOneShot();
65.nextFireTime += fireRate;
}
}
}

70.function FireOneShot () {
var direction = transform.TransformDirection(Vector3.forward);
var hit : RaycastHit;

// Did we hit anything?
75.if (Physics.Raycast (transform.position, direction, hit, range)) {
// Apply a force to the rigidbody we hit
if (hit.rigidbody)
hit.rigidbody.AddForceAtPosition(force * direction, hit.point);

80.// Place the particle system for spawing out of place where we hit the surface!
// And spawn a couple of particles
if (hitParticles) {
hitParticles.transform.position = hit.point;
hitParticles.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
85.hitParticles.Emit();
}

// Send a damage message to the hit object 
hit.collider.SendMessageUpwards("ApplyDamage", damage, SendMessageOptions.DontRequireReceiver);
90.}

bulletsLeft--;

// Register that we shot this frame,
95.// so that the LateUpdate function enabled the muzzleflash renderer for one frame
m_LastFrameShot = Time.frameCount;
enabled = true;

// Reload gun in reload Time   
100.if (bulletsLeft == 0)
Reload(); 
}

function Reload () {
105.
// Wait for reload time first - then add more bullets!
yield WaitForSeconds(reloadTime);

// We have a clip left reload
110.clips--;
bulletsLeft = bulletsPerClip;
}

function GetBulletsLeft () {
115.return bulletsLeft;
}

function Update (){
if (clips == 0){
120.print("get Ammo");
noClips = true;
}
}

125.function pickup(){
}


\e What do you guys do with your programming? :)


Unity Script is not a language based on Java at all.. Welcome to oop.
Not to sound mean but it sounds like you have no idea what you're doing.. Show something you've actually done instead of stuff that's copy/pasted
Member
Posts: 8,370
Joined: Jan 4 2011
Gold: 100.00
Nov 27 2013 09:51pm
Quote (0n35 @ Nov 28 2013 02:49pm)
Unity Script is not a language based on Java at all.. Welcome to oop.
Not to sound mean but it sounds like you have no idea what you're doing.. Show something you've actually done instead of stuff that's copy/pasted


I did meantion how it isn't actually Java or atleast I thought I did.

I was just showing examples my friend. I was saying how I was mucking around with it.
But thank you for your input.

/e
Sorry, I didn't mean to say 'UNITY using the JS it's interesting how it's like its own langue within Java.'
Ha, I meant to say isn't it interesting how Unity has a JS that isn't even JAVA based.

This post was edited by Incisions on Nov 27 2013 09:53pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Nov 27 2013 10:09pm
Quote (Incisions @ Nov 27 2013 10:51pm)
I did meantion how it isn't actually Java or atleast I thought I did.

I was just showing examples my friend. I was saying how I was mucking around with it.
But thank you for your input.

/e
Sorry, I didn't mean to say 'UNITY using the JS it's interesting how it's like its own langue within Java.'
Ha, I meant to say isn't it interesting how Unity has a JS that isn't even JAVA based.


why would you find that interesting? there's no relationship between JS and java.
Member
Posts: 8,370
Joined: Jan 4 2011
Gold: 100.00
Nov 27 2013 10:12pm
Quote (carteblanche @ Nov 28 2013 03:09pm)
why would you find that interesting? there's no relationship between JS and java.


Why do you find Diablo 2 interesting?


I just find it amusing when people say they can code in JAVA because they can code JS.

Now pls. stop. pls. sick of being called newb ):
/e my message may better explain

This post was edited by Incisions on Nov 27 2013 10:16pm
Member
Posts: 11,610
Joined: Oct 28 2008
Gold: 1,795.00
Nov 28 2013 12:07am
Quote (Incisions @ Nov 27 2013 10:12pm)
Why do you find Diablo 2 interesting?


I just find it amusing when people say they can code in JAVA because they can code JS.

Now pls. stop. pls. sick of being called newb ):
/e my message may better explain


If you're only going to talk about how cool you think programming is you're going to be flamed, there are plenty more like you who come through here and leave shortly after
Member
Posts: 2,757
Joined: Nov 26 2007
Gold: 1,214.81
Nov 28 2013 08:53am
I started with Java, then C++, then VB, then C#, then Objective-c, then javascript/html/css/php.

If you're gonna use Unity, you should learn C#. It's a lot more useful than JavaScript in programming and its very similar to Java and C++ so it's easy to transition.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll