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