3D tower defense game achieves 5.2 3D monster death (Feekood language), 5.2 feekood
(Feekood language introduction and study)
Http://www.wooyoogame.com/doc/index (learning)
Http://www.wooyoogame.com (home)
Http://www.feekood.com/(Development page)
----------
The previous article introduced 3D turret attacks.
This article describes how to reduce the volume of monsters and die after 3D turret attacks.
:
Source code link: http://pan.baidu.com/s/1kT7mCAV password: 1oyv
Modify the original"TurretMesh. ais"Script
// Introduce the monster model Foe1 = IncludeAisx (":/Wooyoo/window7/SCORPION. aisx "); Foe2 = IncludeAisx (":/Wooyoo/dosdos/BEAR. aisx "); Foe3 = IncludeAisx (":/Wooyoo/window7/CRYPTFIEND. aisx "); // model texture: CreateMipmap (Foe1.texture); CreateMipmap (Foe2.texture); CreateMipmap (Foe3.texture); // introduce the Include (" MoveData. ais "); FoeMoveBase = {// monster Data: {Blood: 50; Exps: 10; Grade: 1; speed: 3 ;}; Action:" STAND "; // monster action x: 0; y: 0.1; z: 0; show: false; IsHitTest: true; // start the mouse to pick up the IsHitPass: false; // whether to break down state: ""; // The monster status MI: 0; // record the creation of the monster movement point Rotation: 0; // rotation level owner. moveTargetX: 100000; // target position X owner. moveTargetZ: 100000; // target position Z MoveTime: 0; // record the moving time leng2: 0; // The 2nd power of the record distance // A ==> indicates that when A is true, every refresh is executed. // The Monster moves and is created successfully (owner. state = "Move" & owner. name! = Null) ==>{ owner. state = ""; // clear case (owner. MoveTargetX! = 100000 & owner. MoveTargetZ! = 100000, {owner. action = "RUN"; // set the angle between the current location and the target location for the monster to RUN, and rotate the monster to the owner. rotation = Angle2 (owner. moveTargetZ-owner.z, owner. moveTargetX-owner.x); // calculates the square owner of the distance between the current location and the target location. leng2 = pow (owner. moveTargetZ-owner.z, 2) + pow (owner. moveTargetX-owner.x, 2); owner. moveTime = 0; // initialize the moving time // calculate the moving time owner based on the preceding distance and speed. moveTime = Sqrt (owner. leng2)/owner. data. speed * 500; // monster X/Z moves the owner to the target within the computing time. x <: "clear" <: {owner. moveTar GetX, owner. moveTime}; owner. z <: "clear" <: {owner. moveTargetZ, owner. moveTime }<:{// <:{}; the owner is executed only after the computing time. MI + = 1; // The next vertex // determines whether the next vertex exists. case ($ ("MoveData _" + owner. foePosition)-> (owner. MI ). x! = Null, {// exists. The next vertex is assigned to the destination vertex owner. moveTargetX = $ ("MoveData _" + owner. foePosition)-> (owner. MI ). x; owner. moveTargetZ = $ ("MoveData _" + owner. foePosition)-> (owner. MI ). z; // and move the owner. state = "Move ";},! ($ ("MoveData _" + owner. FoePosition)-> (owner. MI). x! = Null), {// No point after the monster STAND owner. action = "STAND" ;};};};};}; // the direction of the monster (Design in the Southeast and northwest directions, so the path is different) FoePosition: ""; IsLoaded: ==>{ // run case (owner. foePosition! = "", {Owner. MI = 0; // initial point 0 // initialize the target point owner. moveTargetX = $ ("MoveData _" + owner. foePosition)-> 0.x; owner. moveTargetZ = $ ("MoveData _" + owner. foePosition)-> 0.z; // start the owner. state = "Move" ;}) ;}; IsHitT: false; // indicates whether to enter the Life tower. Mark IsHitTarget: false; // whether the Life tower targetName :""; // The Name Of The Life tower IsUpdated: => // determines whether a Life tower exists, whether a Life tower exists, and whether a collision occurs. Case (! (Owner.ishitt)&owner.tar getName! = ""&&(! Owner. clearOneself), {// after hitting the Life tower, Hit returns true-false owner.ishittargetincluhit(owner.tar getName, owner. name) ;};}; // collision to Life tower IsHitTarget:-> {owner. state = ""; // clear the owner of the monster state. action = "STAND"; // The monster STAND // removes the monster from the monster set $ ("FoePanel "). foeAssemble >>> owner. name; // move the owner up within 1 s of the monster. y <: {owner. y + 9,1000 }::{ owner. state = "success"; // The Monster reaches the owner. clearOneself = true; // clear yourself}; owner. isHitT = true; // tag and arrival}; Die: false; // death attribute Di E:-> {// death trigger // failed to reach the Life tower case (owner. Die = true & owner. state! = "Success", {// remove monster $ ("FoePanel "). foeAssemble >>> owner. name; owner. XXX = owner. x; owner. ZZZ = owner. z; // The owner of the monster jump action. x <: "clear" <: {owner. XXX, 1}; owner. z <: "clear" <: {owner. ZZZ, 1}; // action does not loop owner. isLoop = false; owner. rotation = Rand (0,360); owner. probRandxy = ProbRand (50, 0, 50, 1); case (owner. probRandxy = 0, {owner. z <: {owner. z, owner. z-2, 500 };}, owner. probRandxy = 1, {owner. x <: {owner. x, owner. x-2, 500 };}); owner. y <: {0, 100}; owner. y <: {1, 0, 350}; owner. action = "mountworkflow sprint"; // slowly disappear the owner. interim1 = 0; owner. interim1 <: {2000,} <: {owner. y <: {0,-0.5, 3000 }}; owner. interim2 = 0; owner. interim2 <: {5000,} <: {owner. clearOneself = true ;};}) ;}; // check the blood volume BloodDieTab at any time: true; (owner. data. blood <= 0 & owner. bloodDieTab) ==>{ // stop the check owner after the blood volume is 0. bloodDieTab = false; // trigger the owner of the monster death. die = true ;}; // Clear your own clearOneself: false; clearOneself:-> {Clear (owner. name) ;}; // The Grade: 0; Grade:-> {owner. data. blood = (owner. grade-1) * 50) + 50); // blood volume owner. data. exps = (owner. grade-1) * 5) + 10); // Add money to the owner. data. grade = owner. grade; // Grade };};