A grass tutorial - Plantation

in Programming & Dev2 years ago

wfewgegge.png

Hello everybody.

This that is following is a simple guide for having a basic plant growing and being cut.

CREATE EVENT

We start in the create event with setting the variable for watering level and setting it to 0.

Here we can set the image_speed to 0 too but it can work in the step event. This will make it so that we have no animation playing and we can choose after how to make it move.

uiod.png

STEP EVENT

In the step event is where we take track of the plant growth. First check we need to do is if our plant is colliding with the water drop (obj_goccia in this case) and if the water level is less then 10. This value is up to what you want to make it do and can be changed.

When the plant and the drop collide we add +1 to water level and destroy the water droplet.

Then we check what is the value of the water and then change the image_index accordingly to make the plant grow.

ddddd.png

Then when we decided that the plant has a maximum growth we check if water is equal or bigger then that number and always set the image index to the maximum growth value.

At this stage the plant can be cut and we do so when it is colliding with the slash. It will create a seed if cut at water level 5.

Last but not least we check if water is minus 0 and then we set it back to 0 so that the plant dosen't go too below and can be grown again after the cut.

sdkkkket.png

The collision with obj_slash set back the water level of the plant by -1, though it has more then one frame so a cutting action will probably deplete all the plant water in one go.

The collision with the Oil tree disrupts the plant but that is not too relevant to the whole process.

qdqddq.png

Following theres a bit of fast paced gardening 🌿🚜

knot.png

Sort:  

that new level you are working on shown at the bottom looks cool too.

I'm trying to make a bit more complex world with these but its hard to optimize! Thank you for your tips on the dev log help a lot to see how you work on the game

This is awesome! thank you for sharing! i cant wait to add this to my game

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support. 
 

Congratulations @mproxima! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You distributed more than 150000 upvotes.
Your next target is to reach 155000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP