by date
The Adventures of TomFeni.. continued..
The Adventures of TomFeni.. continued..
| Name: | Tom Feni | ![]() |
|---|---|---|
| Date Posted: | Jan 17, 2008 | |
| Rating: | Not Rated | |
| Public: | YES | |
| Comments: | YES | |
| RSS Feed: | or Subscribe with . | |
| Profile Page: | View profile page for Tom Feni |
Blog post
So back to what I was talking about. :) Coding.. I started by picking up Ed Maurina's book about game programming. I started by using some of the various examples and changing them to suiit my needs and made new assets.
I added some danger by adding the cannon and flame trap, which worked ok but had some minor issues due to the player being so low to the ground.. I spent a few weeks on figuring out how to get the fire point to hit the player fairly consistently but still needs work(on my todo list :) For now I am using the simple kill trigger and using those at key areas of danger, ie steam from a pipe, and lava so on and so on..
I also added the door resource by Ramen Sama and changed the door models to gates and wooden doors and such. Worked good and all but the challenge was non existent. I needed locking doors.. Then I noticed the locking doors with keys that someone was kind to post in the door resource update I posted. I added that and added quite a few more key types.
I also added exploding boxes, ifl shapes, some animated shapes, and various items. Then I began work on the lives code, I needed to start with a set amount and on entering a kill trigger I wanted the player to lose a life. I scoured the site but didnt find a whole lot for tge but alot of things for TGB so I used the code from Ed's book for the lives. I then tied it into the guis and decided I wanted to have extra life pickups, but Ed didnt do that, his gets extra life on level finish. So I took the health pack code and changed it to suit my needs.
Extra Life code
Worked great but didnt have alot of flair so I added a particle effect to the pickup.
Much neater just adding a particle texture. I then took that particle idea and added it to the egg pickup and to the key pickup. So now all the pickups for the most part have spiffy particles shoot up and then disappear after 1.5 seconds.
Then i took that idea and tried adding it to the exploding box so I could show players which box is destroyable. Which didnt work how I planned.
When I destroyed the box the particles stayed put and didnt leave..
So I tried
In onDestroyed. Didnt work so I went to onRemove and wham.. worked like a charm.. :)
So then i moved on to a simple save system :)
But I will talk about that next time : )
TomFeni
I added some danger by adding the cannon and flame trap, which worked ok but had some minor issues due to the player being so low to the ground.. I spent a few weeks on figuring out how to get the fire point to hit the player fairly consistently but still needs work(on my todo list :) For now I am using the simple kill trigger and using those at key areas of danger, ie steam from a pipe, and lava so on and so on..
I also added the door resource by Ramen Sama and changed the door models to gates and wooden doors and such. Worked good and all but the challenge was non existent. I needed locking doors.. Then I noticed the locking doors with keys that someone was kind to post in the door resource update I posted. I added that and added quite a few more key types.
I also added exploding boxes, ifl shapes, some animated shapes, and various items. Then I began work on the lives code, I needed to start with a set amount and on entering a kill trigger I wanted the player to lose a life. I scoured the site but didnt find a whole lot for tge but alot of things for TGB so I used the code from Ed's book for the lives. I then tied it into the guis and decided I wanted to have extra life pickups, but Ed didnt do that, his gets extra life on level finish. So I took the health pack code and changed it to suit my needs.
Extra Life code
datablock ItemData(lifeUp)
{
// Mission editor category, this datablock will show up in the
// specified category under the "shapes" root category.
category = "Health";
// Basic Item properties
shapeFile = "~/data/shapes/lifeUp/lifeUp.dts";
mass = 1;
friction = 1;
elasticity = 0.3;
emap = true;
// Dynamic properties defined by the scripts
maxInventory = 1; // need this to activate the pickupName
pickUpName = "an extra life";
lightType = "constantLight";
lightColor = "0.4 0.8 0.3 1.0";
lightTime = "1000";
lightRadius = "3";
};
function lifeUp::onPickup(%this, %obj, %user, %amount)
{
// The parent Item method performs the actual pickup.
if (Parent::onPickup(%this, %obj, %user, %amount)) {
$Player::lives++; // give the player one life
serverPlay3D(LifeUpSound,%obj.getTransform());
livescounter.setCounterValue($Player::lives);
}
Worked great but didnt have alot of flair so I added a particle effect to the pickup.
datablock ParticleData(lifePickup)
{
textureName = "~/data/shapes/particles/hearts";
dragCoefficient = 0.0;
gravityCoefficient = -0.2; // rises slowly
inheritedVelFactor = 0.00;
lifetimeMS = 500;
lifetimeVarianceMS = 50;
useInvAlpha = false;
spinRandomMin = -60.0;
spinRandomMax = 60.0;
colors[0] = "0.0 0.0 0.8 0.1";
colors[1] = "0.6 0.0 0.0 0.1";
colors[2] = "0.0 0.8 0.0 0.1";
sizes[0] = 0.1;
sizes[1] = 0.1;
sizes[2] = 0.1;
times[0] = 2.0;
times[1] = 2.5;
times[2] = 2.0;
};
datablock ParticleEmitterData(lifePickupEmitter)
{
ejectionPeriodMS = 35;
periodVarianceMS = 0;
ejectionVelocity = 8.0;
ejectionOffset = 0.45;
velocityVariance = 0.5;
thetaMin = 45.0;
thetaMax = 90.0;
particles = lifePickup;
};
datablock ParticleEmitterNodeData(lifePickupEmitterNode)
{
timeMultiple = 1.5;
};
function lifeUp::onPickup(%this, %obj, %user, %amount)
{
....
%effect = new ParticleEmitterNode() {
position = vectorSub(%Obj.getWorldBoxCenter(), "0 0 1");
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "lifePickupEmitterNode";
emitter = lifePickupEmitter;
velocity = "1";
};
%obj.myEffect = %effect;
%obj.delete();
if(isObject(%effect))
%effect.schedule(1500, "delete");
}
}
Much neater just adding a particle texture. I then took that particle idea and added it to the egg pickup and to the key pickup. So now all the pickups for the most part have spiffy particles shoot up and then disappear after 1.5 seconds.
Then i took that idea and tried adding it to the exploding box so I could show players which box is destroyable. Which didnt work how I planned.
When I destroyed the box the particles stayed put and didnt leave..
function box1::onAdd(%this,%obj)
{
box::onAdd();
%effect = new ParticleEmitterNode() {
position = vectorSub(%obj.getWorldBoxCenter(), "0 0 -1");
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "destroyNode";
emitter = destroyParticleEmitter;
velocity = "1";
};
%obj.myEffect = %effect;
}
So I tried
function box1::onRemove( %this, %Obj )
{
// 1
if( isObject( %Obj.myEffect ) )
%Obj.myEffect.delete();
}
In onDestroyed. Didnt work so I went to onRemove and wham.. worked like a charm.. :)
So then i moved on to a simple save system :)
But I will talk about that next time : )
TomFeni
Recent Blog Posts
| List: | 08/16/08 - Toby Updates for August 07/27/08 - Instant Action Contest Entry 07/19/08 - The Adventures of Toby Turtle Updates 01/26/08 - The Adventures of Toby Turtle Demo 01/17/08 - The Adventures of TomFeni.. continued.. 01/02/08 - The Adventures of TomFeni 12/16/07 - Toby Turtle coming soon! 10/14/07 - Back to work: new outlook |
|---|
Submit your own resources!| Oliver Rendelmann - DerR (Jan 17, 2008 at 08:05 GMT) |
| Tom Feni (Jan 17, 2008 at 10:13 GMT) |
Soo I will be spacing these out.. I also wanted to share some of the code and resources that I included along the way..
obligatory snapshot follows

recent picture of the game
TomFeni
| Guy Allard (Jan 17, 2008 at 17:26 GMT) |
| Sean H. (Jan 17, 2008 at 18:03 GMT) |
| DreamPharaoh (Jan 18, 2008 at 16:48 GMT) |
Take Care
You must be a member and be logged in to either append comments or rate this resource.



Not Rated


