The creation process of the adventures of dogs (the first day of 3d model movement control), The Adventures of 3d

Source: Internet
Author: User

The creation process of the adventures of dogs (the first day of 3d model movement control), The Adventures of 3d

I am eager to write a game to play,

It took about 20 minutes on the first day.

Access the website to run http://www.feekood.com directly /? Path =:/tiantian/KeyMove/MoveDog. ais

You can move a dog by pressing the top, bottom, left, right, and right (the camera follows the dog)


Register an account for www.wooyoogame.com, and then go to http://www.wooyoogame.com/resource/5373to use the model resource of the dog.
Clear (); LoadImage ("floorImg", ":/Samples/Images/floor.png"); // read the platform's built-in image resource CreateMipmap ("floorImg", 16 ); // Create a mipmap Image Create ({type: "box", width: 100, height: 0.01, length: 100, texture: "floorImg", IsAutoTexcoord: true, SimplerState: "wrap"}); // create a ground mesh = IncludeAisx (":/Wooyoo/window7/PUG. aisx "); // read model resources of the wooyoo platform dogs // dog action support: //" RUN, STAND, STAND1, STAND2, STAND3, WALK, STAND4, ATTACKUNARMED, COMBATWOUND, DEATH, "// create a fixed-angle camera SetCamera (camera = {position: {0, 5,-5}, target: {0, 0}, up: {0, 0, 1}, AllowVRotation: false; // turn off the horizontal rotation of the mouse AllowHRotation: false; // turn off the vertical rotation of the mouse AllowZoom: false; // turn off the middle mouse zoom }); // set the dog configuration information myDog = {Action: "stand"; Rotation: 0; X: 0; Y: 0; Z: 0; // If the x coordinate of the dog changes, the camera changes (the camera tracks the dog) X:-> {camera. position = {owner. x, 5, owner. z-5}; camera.tar get = {owner. x, 0, owner. z };}; // If the zcoordinate of the dog changes, the camera changes (the camera tracks the dog) Z:-> {camera. position = {owner. x, 5, owner. z-5}; camera.tar get = {owner. x, 0, owner. z };}; doing: "stand"; // custom attributes, dog action moveSpeed: 0; // custom attributes, dog action rotateAnim: 0; // custom attribute, dog rotation angle target lastRotateAnim: 0; // custom attribute, dog Rotation Angle saved last time // rotation angle target change, rotateAnim:-> {owner. rotateSin = sign (owner. lastRotateAnim-owner.rotateAnim); owner. rotateOff = abs (owner. lastRotateAnim-owner.rotateAnim); case (owner. rotateOff <= 180, {owner. rotation <: {owner. lastRotateAnim, owner. rotateAnim, 300 };}, {owner. rotation <: {owner. lastRotateAnim, owner. lastRotateAnim + owner. rotateSin * (owner. rotateOff-180), 300 };}); owner. lastRotateAnim = owner. rotateAnim ;}; // the built-in attributes of each frame update, which controls the dog's Model Bone animation IsUpdated according to the changes in doing attributes: =>{ owner. moveSpeed = Sys (). usedTime/1000; case (owner. doing = "stand", {owner. action = "stand";}, owner. doing = "GoUp", {owner. action = "walk"; owner. rotateAnim = 0; owner. Z + = owner. moveSpeed;}, owner. doing = "GoDown", {owner. action = "walk"; owner. rotateAnim = 180; owner. z-= owner. moveSpeed;}, owner. doing = "GoLeft", {owner. action = "walk"; owner. rotateAnim = 90; owner. X + = owner. moveSpeed;}, owner. doing = "GoRight", {owner. action = "walk"; owner. rotateAnim = 270; owner. x-= owner. moveSpeed;}) ;};}:: mesh; // Create a dog instance Create (myDog); // defines the key event information keyInfo = {ID: 0; // event number [built-in attribute] Key: ""; // Key content [built-in attribute] IsKeyDown: false; // press the button to press the event [built-in event] IsKeyUp: false; // press the button to pop up the event [built-in event] // define the event trigger. Press the button to run the expression IsKeyDown :=>{// press the upper and lower buttons to control the dog action case (owner. key = "UP", myDog. doing = "GoUp", owner. key = "DOWN", myDog. doing = "GoDown", owner. key = "LEFT", myDog. doing = "GoLeft", owner. key = "RIGHT", myDog. doing = "GoRight") ;}; // defines the event trigger. When a button is popped up, the running expression IsKeyUp :=> {myDog. frame = 0; myDog. doing = "stand" ;};}; KeyReceive (keyInfo); // receives the key message

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.