3D tower defense game realizes 1.1 3D map, 3d1. 1

Source: Internet
Author: User

3D tower defense game realizes 1.1 3D map, 3d1. 1
Body 3D Map

(The 3D map has an example script: "/Samples/Terrain/3D Terrain/HitTerrain3D. ais ")
The source code of my 3D map is as follows:
(Graph used)

Basic Map
MapBase. ais

LoadImage ("Map1Img", "1.png"); // caocolored LoadImage (" Map2Img "," 2.png"); // Yellow Stone LoadImage ("Map3Img", "3.png "); // brown stone LoadImage ("Map4Img", "4.png"); // sand CreateMipmap (" Map1Img "); // create a straw mipmap image CreateMipmap (" Map2Img "); // create a yellow stone mipmap image CreateMipmap ("Map3Img"); // create a brown stone mipmap image CreateMipmap ("Map4Img"); // create a sand mipmap image Include ("MapDataA. ais "); // map height data group MapA = {type:" tex4Terrain3D "; width: 32; // map width height: 32; // map length Texture1: "Map1Img"; // grass-colored mipmap Texture2: "Map2Img"; // Yellow Stone mipmap Texture3: "Map3Img"; // brown stone mipmap Texture4: "Map4Img "; // sand mipmap GridWidth: 4; // grid width GridHeight: 4; // grid length SimplerState: "wrap"; // Simpler: "point"; Column: 32; Row: 32; cullMode: "none"; shader: "phong"; // ratio of grass, Yellow Stone, brown stone, and sand on the ground Data: set (this. width + 1) * (this. height + 1), {w1: probRand (50,1, 50,0), w2: probRand (90,1-this. w1, 10, 0), w3: 1-(this. w1 + this. w2), w4: 0}); // the height in the map lattice to generate the height of the terrain. High: set (this. height + 1) * (this. height + 1), 5); x: this. width * this. gridWidth/-2; // set y: 0 in the map center position X; z: this. height * this. gridHeight/-2; // map center position Z setting}; MapA. hights = MapDataA; // sets the map height data.

Map height data
MapDataA. ais

MapDataA={5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,0,0,0,5,5,5,5,5,5,5,5,5,5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40}; Target: {, 0}; Up: {, 0}; AllowVRotation: false; AllowHRotation: true; field: 1; Near: 0.01; Far: 200.0;}; // assign a value to the main angle = initial angle MainCamera = initialiseCamera; // SetCamera (MainCamera );

Main Function
MainMap. ais

Include ("MapBase. ais "); // introduce the basic map file include (" SetCamera. ais "); // create ({}:: MapA) from the application perspective file; // create a map, for inheritance

Final effect:

Folder:

--------- Complete

Previous: Online development and compilation of script language
Game link jump
You need to install a plug-in when running: (After studying it, you actually have installed a "Microsoft Silverlight" and the permission to open "3D images)

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.