Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
At last something you can shoot at...and be shot at. Smile

I've had a real struggle with this..trying to keep the .bb file to below 16k and keeping within the 80k forum limit, hasn't been easy. I've had to strip out much of the code comments from the .bb file and to keep within the forum limits there are four files to download.
Some of the files are duplicate of what you may already have but it keeps things simple this way.

I've changed a few things so before you play......
There is now a Mouselook feature..... and the move forward and move back keys have changed.
You now move forward with the "A" key and back with the "Z" key.
Use the mouse to look left, right,up and down....and then press either the "A" or "Z" keys to move.
Fire with the Left Mouse button.

You have to include something like this when you need aim a weapon quickly and accuratly, I've also included an aimsight, just to help you out. Smile
When the game starts you are in a safe position, so get used to the mouselook before you move anywhere. The shotgun is visible to you and you can even practice firing with the LMB....BUT...be warned... you are being watched...move at your peril. Big Grin

You have three lives and need to exterminate all the alien flying thingies, I'm sure you can produce better things to shot at than this...mine were just quickies. If you do manage to see off all of the baddies you will recieve a message telling you so and a different message if you fail. I haven't made things to difficult but you can increase this by reducing the number of lives you have.
Look at where the Global variables are and change the p_lives variable to 2 or even 1 if you fancy your chances.

I'll write up a description of all the new bits of code that are included and post them shortly If you come across anything that doesn't work correctly let me know...I'm getting fed up of testing, it so now it's your turn
You have four files to download....

Unzip the G1.zip file to your MY_Games folder...This should give a folder called BlitzGameOne with just the .bb file in it.

Bazza


Mrs Bazza says "just keep taking the tablets dear, and everything will be OK"


Zip/GZ archiveG1.zip (5 Kb, 749 downloads)
 
Posts: 985 | Location: Lincolnshire, UK. | Registered: Fri November 07 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Unzip the G1Models.zip file to the BlitzGameOne folder

This message has been edited. Last edited by: Bazza,


Mrs Bazza says "just keep taking the tablets dear, and everything will be OK"


Zip/GZ archiveG1Models.zip (71 Kb, 498 downloads)
 
Posts: 985 | Location: Lincolnshire, UK. | Registered: Fri November 07 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Unzip the G1Textures.zip file to the BlitzGameOne folder

This message has been edited. Last edited by: Bazza,


Mrs Bazza says "just keep taking the tablets dear, and everything will be OK"


Zip/GZ archiveG1Textures.zip (48 Kb, 459 downloads)
 
Posts: 985 | Location: Lincolnshire, UK. | Registered: Fri November 07 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Unzip the G1Sounds.zip file to the BlitzGameOne folder

Now you can run the Shooting2 .bb file...Good luck

Let me know what you think.

Bazza

This message has been edited. Last edited by: Bazza,


Mrs Bazza says "just keep taking the tablets dear, and everything will be OK"


Zip/GZ archiveG1Sounds.zip (43 Kb, 445 downloads)
 
Posts: 985 | Location: Lincolnshire, UK. | Registered: Fri November 07 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
The file Shooting2.bb is about as large as you will be able to run with the demo version of Bliz3D so if you want to proceed it's time to spend some cash and get the full version. Smile
You will of course still be able to write routines like the shooter demo but you won't be able to bring them all together to produce a full size level/game. Frown
There is much I would have liked to have added to give this demo better gameplay...puzzzles...keys....health pickups etc but it can't be done with a file limit of 16k.
I wasn't able to document the code so here's some notes...it may be worth printing them out if your trying to understand the Shooting2.bb file.

Quite a lot of new variables have appeared, most of these are what I call flag variables....you can tell the state of something by reading the value of the variable...ie...

Global Shotgun_flag = 0

If EntityVisible( Campivot,shotgun ) And shotgun_flag = 0
TurnEntity Shotgun, 0,5,0
Endif

This tells Blitz to rotate the shotgun if it's visible to the camera BUT only if the flag = 0

When the weapon is picked up the flag is set to 1..ie...

If EntityCollided(Campivot,Shotgun_col)
do whatever...
Shotgun_flag =1
Endif

So now you can check when the player presses the " Fire " key if he has the shotgun...ie...

If KeyHit(29) and Shotgun_flag =1
Fireweapon( )
Endif

Two conditions have to be met...first the fire key has to be pressed AND the shotgun_flag must = 1 before Blitz will jump to the FireWeapon( ) function.

Everything in your game that needs the player to have done something before something else happens will need a flag variable. A locked door for example, where the player needs to find a silver key to open it, would go something like this...

Global SilverKey_flag = 0

If EntityCollided( Campivot,Door_col) and SilverKey = 0
Print " YOU NEED THE SILVER KEY "
Endif

When the player finds the silver key set the flag to 1 so the next time the player collides with the door....

If EntityCollided( Campivot,Door_col) and SilverKey = 1
OpenDoor( )
Endif

Blitz will now jump to your OpenDoor( ) function.
You would need quite a number of these flag variables in a full game so try and make them understandable to read so you know what each one does...SilverKey_flag is much more understandable than SK_flag when you are trying to de-bug.

Nested If / Then statements.....
Much of the code in these demo's could be optimised (made more efficient ) if the If / Then statemants were 'nested'...I haven't done this to keep things more understandable....ie

If EntityCollided ( Campivot,Door)
If SilverKey_Flag = 0
Print " YOU NEED THE SILVER KEY "
Endif
If SilverKey­_Flag = 1
OpenDoor( )
Endif
Endif

This gives exactly the same result as the first Silver key example but in one statement. The problem with nested If / Then statemens is that once you get above THREE nested If / Then's things start to get confusing......to me anyway.
The way around this is to use the Select / Case commands...you will find some examples in the Shooter2.bb file.
You set up a Global variable that you can pass information to, you then use the Select / Case commands.....

Suppose the player has picked up six weapons and you want to use the number keys so he can change weapons.
This is what you do.....first set a Global variable....Global WeaponChoice = 0
Then when the player presses any of the number keys ( 1 to 6 ).....

If KeyHit (2)
WeaponChoice=1
ChangeWeapon ( )
End if

If KeyHit (3)
WeaponChoice=2
ChangeWeapon ( )
End if

This sets WeaponChoice to the key number pressed and jumps to the ChangeWeapon( ) function....

Function ChangeWeapon( )

Select WeaponChoice

Case 1
HideEntity Nailgun
ShowEntity Shotgun

Case 2
HideEntity Shotgun
ShowEntity Nailgun

End Select
End Function

When Blitz looks at the ChangeWeapon( ) function it selects the Case statement relative to the value held in the variable WeaponChoice ...hides the current weapon and shows the new weapon.

I'll run through all the TYPES and weapon firing next...Thats it for now.

Bazza


Mrs Bazza says "just keep taking the tablets dear, and everything will be OK"
 
Posts: 985 | Location: Lincolnshire, UK. | Registered: Fri November 07 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Thanks bazza, I've copied the "lessons" into a notepad. I know I'll have to study these to get any where. Smile
 
Posts: 334 | Registered: Fri November 07 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
All the aliens are set up using a TYPE ie...

Type Aliens
Field obj, x#, y#, z#, life, timer
End Type

obj = ..................each alien entity
x# , y#, z# =......each aliens start position
life = ..................each aliens life value
Timer = ..............the time lapse between firing for each aliens rockets

You only need to define this type once, from this you can produce as many aliens as your sytem will take.
First you load in an alien using LoadMesh...Scale it and Hide it. From this hidden alien you can make as many copies as you wish

alien=LoadMesh "Models/alien.b3d"
ScaleEntity alien ,4,4,4
HideEntity alien

All the aliens are then created in one For / Next loop, but first you need to tell Blitz where to look for the data to position each alien........

Restore AlienData

Then start the loop....

For r = 1 To 3
al.aliens = New aliens
al\obj = CopyEntity (alien)
Read al\x, al\y, al\z
PositionEntity al\obj, al\x, al\y, al\z
EntityRadius al\obj, 1.5
EntityType al\obj, alien_col
al\life =20
AlienCount = r
Next

.AlienData
Data 0, 0, 33
Data 27, 0,-15
Data 36, 0, -39

Each time Blitz runs through the loop it creates a new alien entity with a the prefix " al "....makes a copy from the original alien that was hidden......Reads the line of data from the label .AlienData.......Positions it.
Gives it a Radius.....Assigns a Collision Type.....Loads the life of each alien, in this case 20.

I've used one other variable....AlienCount...this holds the total number of aliens created, each time an alien is destroyed, AlienCount is reduced by 1. When all the aliens are destroyed you give the message "ALL ALIENS EXTERMINATED". You can do this another way but for now this is easier to understand.

In a full game, instead of the message you could make available say a silver key or some part of a puzzle the player needs to solve.

From all this it's then quite simple to make each alien " Chase " the player ...this is done in the Update_Aliens Function...again done with a For / Next loop

For al.aliens=Each aliens
If EntityVisible (al\obj,camera)
al\timer=al\timer+1
PointEntity al\obj,camera
MoveEntity al\obj,0,0,.1
If al\timer=60 And p_lives > 0
Create_AlienBullets()
al\timer=0
EndIf
EndIf

If EntityCollided(al\obj,bul_col)
MoveEntity al\obj,1,1,-1
al\life=al\life -5
EndIf

If EntityCollided(al\obj,body_col)
p_health=p_health -2
EndIf

If al\life=0
FreeEntity al\obj
Delete al
AlienCount=AlienCount-1
EndIf

Next

First Blitz checks each alien entity to see if the player is visible using the EntityVisible command. If so it increases the aliens " firing timer" by 1....points the alien at the player with the PointEntity command and moves it forward.
Next the timer is checked to see if it = 60, If so Blitz will jump to the Create_AlienBullets command and the set the " firing timer " back to 0.

The timer just gives pause between each of the aliens bullets, just enough for the player to move out of the line of fire.

Each alien is also checked for a collison with the player, in which case the players life is reduced by -2. And with the players bullets, in wcich case the aliens life is reduced by -5.

Also each aliens life must be checked, if it = 0 the alien is deleted with the FreeEntity command and Delate al....
the variable AlienCount is reduced by one.

This last check is linked to the players bullets which I'll describe next....

Thats it for now .

Bazza


Mrs Bazza says "just keep taking the tablets dear, and everything will be OK"
 
Posts: 985 | Location: Lincolnshire, UK. | Registered: Fri November 07 2003Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Don't stop now, This is too good for us wannabe game programmers!

Richard


"I'm that other Richard..."
"You can get the h**l out of Texas, but you can't get Texas outta you!"
 
Posts: 199 | Location: Colorado Springs, CO, USA | Registered: Fri February 20 2004Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Hi Richard, sorry I thought I'd finished this. I'll write up the final part.

Bazza


Mrs Bazza says "just keep taking the tablets dear, and everything will be OK"
 
Posts: 985 | Location: Lincolnshire, UK. | Registered: Fri November 07 2003Reply With QuoteEdit or Delete MessageReport This Post
Newcomer
Posted Hide Post
When I go to run the code I get this error:

"Memory access violation"

Any idea on what the problem is?
 
Posts: 24 | Registered: Tue October 19 2004Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
If you haven't changed any of the code,Blitz is looking for a file it can't find, so you get an error.

Make sure the folders are correct. You should have a main folder called BlitzGameOne with the .bb file inside it.

Inside the BlitzGameOne folder you also need the Models, Textures and Sounds folders.

Bazza


Mrs Bazza says "just keep taking the tablets dear, and everything will be OK"
 
Posts: 985 | Location: Lincolnshire, UK. | Registered: Fri November 07 2003Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 


© Amabilis Software 2003-2007