Showing posts with label Shooter. Show all posts
Showing posts with label Shooter. Show all posts

Monday, July 18, 2011

Professional Top Down Shooter Game in Unity

http://forum.unity3d.com/threads/82719-3D-Top-Down-Shooter-Gamekit-now-on-Game-Prefabs?highlight=shooter

This new version of the top down shooter gamekit let you help to make very adictive top down shooters in 3D that have made popular with games like Minigore and Guerilla Bob.


This package will help you to shorten the development period of your game the maximum possible, withmore than 1500 lines of code divided in 40 Scripts that includes:

• 2 Types of player control: Typical Top Down Shooter and over-the-top third person shooter (Like ShadowGrounds games).



• 2 Game Modes: Stage Mode and Survival Mode, Including a “Bonus Level” too (Only added in Stage Mode)


• A fully Customizable AI with a large variety of parameters, that allows the enemies various types of actions like melee attack, shooting or jump over the player, between others. And a variation of this script with object avoidance.


• A Simple but very effective Spawn Director, that allows spawn enemies and items too. 
• Five Weapons divided in 3 types of shoot: Proyectiles, particles(FlameThrower) and explosives. 
• An arcade-like Stage Clear Scene.



• Dozens of global variables for gameplay seetings and player stats. 
• 5 types of items and a enemy loot script that let you configure the drop item game of everytype of enemy(prefab = type of enemy). 
• a customizable Melee weapon script.
• And much more...

Package Content:

• 3 test scenes: Control Type 1, Control Type 2 and Stage Clear. 
• All necesary art resources for prototyping. 
• 40 ready to use scripts.

PRICES: 

Special June Rebate Offer:

- 75% off from 1st June to 7th June (25$ Indie License)
- 66% off from 8th June to 15th June (33$ Indie License)
- 50% off from 16th June to 22th June (50$ Indie License)
- 33% off from 23th June to 31th June (66$ Indie License)

Once finished the offer, will have a permanent price of 75$ Indie.

Preview Demo:

- Preview 1: http://www.gameprefabs.com/products/preview/237
- Preview 2: http://dl.dropbox.com/u/2358594/3DTDSGAME2.html

Purchase Page:

http://www.gameprefabs.com/products/show/237

Unity FPS Shooter Game tutorial #6

http://unity3d.com/support/documentation/ScriptReference/Component.BroadcastMessage.html


Component.BroadcastMessage  

function BroadcastMessage (methodName : string, parameter : object = null, options : SendMessageOptions =SendMessageOptions.RequireReceiver) : void

Description

Calls the method named methodName on every MonoBehaviour in this game object or any of its children.
The receiving method can choose to ignore parameter by having zero arguments. if options is set toSendMessageOptions.RequireReceiver an error is printed when the message is not picked up by any component.
/// Calls the function ApplyDamage with a value of 5
BroadcastMessage ("ApplyDamage", 5.0);

// Every script attached to the game object and all its children
// that has a ApplyDamage function will be called.
function ApplyDamage (damage : float) {
print (damage);
}

Unity FPS Shooter Game tutorial #5

Picking up a weapon

var gotShotgun : boolean = false;
 var gunPickupSound : AudioClip;
 function Start ()
//playerWeapons is the players selectable weapons 
playerWeapons = this.GetComponent("PlayerWeapons");
 }
 function OnTriggerStay ()
{
 if (Input.GetButtonDown("Pickup"))
gotShotgun = true; 
Destroy(gameObject);
 //Play Gun Pickup Sound
 if (gunPickupSound) 
AudioSource.PlayClipAtPoint(gunPickupSound, transform.position); 
print("You Picked Up The Double Barel Shotgun"); 
}
 }

Wednesday, June 29, 2011

Unity FPS Shooter Game Tutorial #3

Here is a modification in the launcher script to shoot two types of weapons
=================================================================================================================================================================================================================================

var projectile : Rigidbody;
var projectile2 : Rigidbody;
var speed = 20;

function Update () {


 if( Input.GetButtonDown( "Fire1" ) )
{

         var instantiatedProjectile : Rigidbody = Instantiate(
projectile, transform.position, transform.rotation );


instantiatedProjectile.velocity =
transform.TransformDirection( Vector3( 0, 0, speed ) );


   Physics.IgnoreCollision( instantiatedProjectile. collider,
     transform.root.collider );



}



if( Input.GetButtonDown( "Fire2" ) )
{

         var instantiatedProjectile2 : Rigidbody = Instantiate(
projectile2, transform.position, transform.rotation );


instantiatedProjectile2.velocity =
transform.TransformDirection( Vector3( 0, 0, speed ) );


   Physics.IgnoreCollision( instantiatedProjectile. collider,
     transform.root.collider );



}








}
==============================================================================================================================================================================================================================















Here is the two rigid bodies are a sphere (red sphere) and a cube(Xcube)

Monday, June 27, 2011

Instantiate a projectile for a Shooter Game

// Instantiate a rigidbody then set the velocity

var projectile : Rigidbody;

function Update () {
// Ctrl was pressed, launch a projectile
if (Input.GetButtonDown("Fire1")) {
// Instantiate the projectile at the position and rotation of this transform
var clone : Rigidbody;
clone = Instantiate(projectile, transform.position, transform.rotation);

// Give the cloned object an initial velocity along the current
// object's Z axis
clone.velocity = transform.TransformDirection (Vector3.forward * 10);
}
}

Sunday, June 26, 2011

destroy an object when a certain number is reached? (Hit Points)


This is captured from Unity Answers
====================================================================================================================================================================
I'm trying to work on some basic AI and such. I just started learning it. Right now I'm trying to kill off an enemy (a box at this point) by reducing it's health to 0. When it reaches 0 or less, I want the object to be destroyed, but it's not working. Eventually I'll add things that modify the amount of dmg an enemy receives based off attack and such, but this little problem is holding up the whole operation.
Here's what I have JavaScript:
var Health = 100;

function update()
{
if (Health <=1)
{
Destroy (gameObject);
}

}

function OnMouseUp()
{
Health -= 10;
}
========================================================================================
Algorithms is wrong and needs to be corrected
=========================================================================================
The update function won't run automatically unless it's correctly named ("Update", not "update"). However, there's no need for that to be in Update in the first place, because Update runs every frame and you only need to check when the health actually changes. (Also, if you want it to be destroyed when the health is 0, it needs to be <= 0, not <= 1, which would destroy it if the health was 1.)


==================================================================================
Correct Algorithm
================================================================================

var Health = 100;
function Update() {
CheckHealth(); }
function CheckHealth() {
if (Health <=0) { Destroy (gameObject); } }
function OnMouseUp() { Health -= 10; }