Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 10 Sep 2010
Offline Last Active Dec 22 2013 08:33 PM

Topics I've Started

Why "double declare" classes? (Lack of better terminology)

11 December 2013 - 10:40 PM

I tried google, but can't find a good way to ask this question... lol


For instance:


myClass anObject = new myClass;



Why do you declare a myClass, then specify "new myClass"


In my mind, it's the same as:

int myNumber = new int.


"No shit, it's a new int! If I wanted a f***ing float, it woulda said 'FLOAT myNumber'!!!"

If I wanted a "new yourClass", I would've typed "yourClass anObject"





And for that matter, what would be a good search phrase to find info on this, cause "why double declare class" and "why declare a class instance as new" and all the related phrases that come to mind don't turn up a damn thing....


Thanks, cause this is really bugging the shit outta me.

sketch or modeling software for tablets?

01 December 2013 - 06:42 PM

I've seen one sketch program in the Google play store. It made me wonder if any of you used them, if they're sufficient to do indie developer needs?

the importance of understanding theory?

01 December 2013 - 06:29 PM

Do you believe it's important to understand the theory behind your applications? For instance, using state machine to control animation. Unity uses a graphical representation of it to help set your animations. My understanding of what a state machine even was, was nil when I started, but I still managed to use it correctly without understanding it. I have a habit of needing to understand those things though, if just for peace of mind, so I learned a bit about it. Its not rnoiugh for me personally to understand "this works," I need to know "why and how does this work?"

Any of you feel that way, or do you feel that its pointless to research theory so long as you manage to accomplish your goal?

Advice to someone learning pathfinding?

28 November 2013 - 08:41 AM

Just found out Unity's NavMeshes, etc. aren't available in the free edition, so I'm going to have to take to pathfinding the old fashion way--coding it myself.  This is going to be an entirely new endeavor for me. 


Any advice?  Like things to avoid doing, what topics are basics/which are advanced pathfinding topics, what I should definitely have an understanding of before jumping into it (theories, programming aspects, etc.)?




Also, just out of curiosity, is this the hardest part of AI programming? If not, what do you think is?

[SOLVED] Is there a better way to detect player within range?

27 November 2013 - 04:16 PM

In my game, I have various doorways that act as spawn points for enemies.  I'm trying to limit the spawners to only spawning when the player is determined to be within 10 meters of the spawn point (I'm only assuming this is the standard way enemies are randomly spawned in the majority of games...  Having never done this before, this is the first way that came to my mind: Looping through each degree of a full 360* circle, determine all colliders within range (in my case, 10 meters) and if one of them is the enemy, spawn an enemy; if not, finish the circle, wait one second and repeat.


The following is my code for this.  (With extra commenting just to make it beyond plainly obvious what each line is for, lol)  This does have the basic functionality I'm looking for, but since I haven't done it before, I'm curious if this is the best or most efficient way to do what I'm trying to do.


Thanks for the help!

public IEnumerator SpawnAnEnemy() {     
	while(Player.amIAlive) {
          	if (EnemyCount < MaxEnemies){
			for (float degree = 0; degree <= 360; degree++){	
				angleToV3Conversion = new Vector3(Mathf.Sin(Mathf.Deg2Rad * degree), 0, Mathf.Cos(Mathf.Deg2Rad * degree));	//CONVERT DEGREE TO A POINT IN 3D SPACE
				rayCastHitInfo = Physics.RaycastAll (transform.position, angleToV3Conversion, 10F);                    //PLOT RAY AT SPECIFIC ANGLE, RETURN ALL HITS IN THAT DIRECTION
				for (int hitNumber = 0; (hitNumber < rayCastHitInfo.Length); hitNumber++){                         //LOOP THROUGH EACH RETURNED HIT
					if (rayCastHitInfo[hitNumber].collider.gameObject.tag == "Player"){              //IF RETURNED HIT WAS PLAYER
						Instantiate (enemy, new Vector3(spawnX, spawnY, spawnZ), new Quaternion(spawnXRot, spawnYRot, spawnZRot, 0));       //SPAWN ENEMY AT SPECIFIED LOCATION
						yield return new WaitForSeconds(1F);	//EXIT LOOP FOR ONE SECOND
		yield return new WaitForSeconds(1F);  
}//If enemy count is less than maximum & Player in range, spawn enemy, increment count, and wait 1 second--repeat.