Caged Extinct Bird in Prison on Decentraland (DCL) Platform. MANA Coin.

in #bird6 years ago (edited)

For Full YouTube Video: Click Here

Hello everyone. In this demo I have a bird boxed into my Decentraland model. It is flying left, right, up, and down. It also rotates as I will show on this screen. In the video I will over the source code. Now as a disclaimer this code is not perfect. But you can improve upon it and make it better. I will have this up on GetHub as well. And in my next project I will improve this code a bit and integrate this bird into the cartoon house model and with the flying robot.

From the TSX file

Line 2: This is the library I am importing into my work-space.

Line 7: This section contains my initial variables. Both the networkHz and interval variable help determine the speed this extinct bird is moving. Variables x, y, and z reflects the initial position my bird will start on. Variable m reflects the steps my bird takes from it's previous position on the x, y, and z coordinate plane.

Line 17: This section of my code uses a base class from DCL. That class is called ScriptableScene as you see below.

Line 28: This section of the code is like a loop that is set to position the extinct bird on my plane. This loop runs at a stop time determined by the interval variable as declared on the top. Here is making t a randome variable which I do not really need because I have several random variables in the top. But to make this project work I needed something here. So I just made t a random variable.

Line 40: This section is supposedly called before a scene is destroyed. Perform any necessary cleanup in this method, such as cancelled network requests, or cleaning up any elements created in sceneDidMount. I am not too clear on this as I really started testing to see if this works. But when you are diving into this type stuff you have to trust to some level what the DCL api is doing.

Line 50: Here is the interesting part of the code. x, y, and z reflect all axis. I have each poistion fixed to the boundaries of my plane so that the bird does not fly away. m is the incremental position I am moving the bird. You guys can play around with these variables to get an idea of how this works.

Final Line 115: In this section I am showing the bird at different intervals within the screen based on the above variables at their respective intervals. The skelectalAnimation portion came from the scene.gltf file. I had to open it in notepad to find that particular section. Now I did not animate this bird. This bird was created and animated by Charlie Tinley. He uploaded this on Sketchfab. So all I did was download the bird and find where the animation was present in the scene.gltf file. And that section of code was on line 222. Okay guys that is all I have for today. I will have the source code up on GitHub. In the next project which will be project 18, I will fit this bird into the flying robot and cartoon house scene. Now this code is not perfect. You guys can download it on your local machine, tweak it, and figure it out from there so you can make it better and also get an idea of how you want to improve your land on DCL. And if you have any questions, or comments please leave it on YouTube or Steemit and I try to reply back.


Nick is a content creator for Sobuka with a background in programming, information technology, finance and digital forensics. He shares interest in cryptocurrencies by reporting on International Affairs. You can find myself, B, and Laura here from time to time.


Support the cause if you like what we say here on Sobuka

MANA (Obviously): 0xbc96793647728de43206cb925e7d3ab68352009f

BTC: 16wWyinHnue6fwoszr6kKsZfuyYacf2wxQ

ETC: 0x99BcEa1266D2ed8ABAc754035a49B7F80412812e

LTC: LUeqoRJ5sR6Hzy3p7EHcwwWf9v81XQu7oE

You can reach the team here

Facebook
Twitter
YouTube
Steemit: @Sobuka

Bird Design by Charlie Tinley @SketchFab
Gethub Files by Sobuka with inspiration from DCL

Disclaimer
The information on this blog is not financial advice. Before you invest in cryptocurrencies, please speak to a financial advisor.