Pikmin fangame engine/Creating hazards
This page will guide you on how to create hazards for the Pikmin fangame engine. For clarity, know that a hazard is just an abstract danger, not a physical object. Poison, fire, water, electricity, are all hazards. Gas pipes and fire geysers are obstacles, bodies of water are a type of sector, and electrical attacks from enemies are a property given to an attack; all of these use a hazard, but are not hazards.
Pikmin can be vulnerable or invulnerable to a certain hazard. If they are invulnerable, they will be completely invulnerable to any attack hitboxes that use that property, and will act as if it doesn't exist. If not, it will suffer from some status effect. Being on fire, flailing on the surface of the water, or choking on poison are all status effects. Before you implement hazards, you must have some status effects, otherwise the hazards will be pointless if they can't cause problems. Please read the status effects guide for information on how to declare status effects.
The text file
Game_data/Misc/Hazards.txt specifies what hazards exist, as well as their properties. Each main block in that file is one hazard, and the block's name is the hazard's name, which is what must be used to refer to it by.
To create a normal hazard, simply specify the following properties on its block:
color: A color that represents the hazard, in the format
r g bor
r g b a.
status: Status effects to apply to any Pikmin that is not invulnerable. This list is separated by semicolons (;), and can have only one status effect.
Water and other liquids
As is stated at the start of the page, a hazard is an abstract danger. This means that a body of water is not a hazard, but the concept of "water" is. The thing is, hazards like water and other liquids, like acid or lava, are meant to be used on sectors and have a liquid appearance, with an animated water surface. Simply stating that a water hazard applies the "drowning" effect to non-Blue Pikmin, and having a sector use the "water" hazard is not enough. How can the engine know what color the water is, how opaque it is, and what its surface animation is? For this, we'll need a different file.
Game_data/Misc/Liquids. This contains data about all liquids. Liquids will bridge the gap between a water body sector and the water hazard, for instance. Much like
Hazards.txt, this is a text file in which each block is one liquid definition; the block's name is the liquid's name.
Each liquid has the following properties:
color: Color of the liquid, in the format
r g bor
r g b a. In-game, the terrain below the liquid's surface will be tinted with this color.
animation: Name of the animation text file in
Game_data/Animations, with extension included (e.g.
Water.txt). The water's surface will have this animated texture on it. Note: Since the sprites used for the animation are tiled over and over across the water's surface, you will not be able to have multiple frames of animation in the same image file. When making its animation, make sure to have each frame on its own file.
surface_1_speed: Liquids have the surface animation drawn twice, one layer on top of the other. The fact that they scroll at different speeds is what gives the full surface a dynamic look. This property sets the scrolling speed of the top layer, in pixels per second.
surface_1_speed, but for the bottom layer.
surface_alpha: Opacity (0 - 255) of the entire surface.