Java Reference
In-Depth Information
If the cow has hit the ground (tested with cow.isOnGround() ), then we make the
cow explode and remove this task so it won't run again. We're done. But if
the cow is still flying through the air, then we'll make sure it's still on fire
with cow.setFireTicks(600) and bump up its health to the maximum to keep it
alive a little longer. That actually looks a lot crueler in writing.…
The result? You wave your leather as a magic wand, and shoot flaming cows
that explode on impact.
The full code for both and is in code/CowShooter/src/
cowshooter .
Now isn't that a lot more fun than printing Hello,World?
Next Up
In this chapter you saw some Java mechanics, including how to create a new
class and more on creating objects from classes. But the cool part is being
able to run tasks in the background that keep running, which lets you
implement cool things like flaming, exploding cows.
Next we'll cover how to save data and remember it despite the game being
shut down, rebooted, or turned off.
Search WWH ::

Custom Search