Tutorial: Basic Entity
Note: Infomation is from a older version of Mokoi Gaming and may not correct.
Step 1
Using the Previous Tutorial as the starting point, switch over to Entity Editor and click the Add button
Step 2
Now you can open up firstentity.mps
Step 3
#include <default>
#include <graphics> // Added Graphics functions declarations
#include <entities> // Added Entities functions declarations
/* Initialise Two Fixed valiables to hold position */
new Fixed:x = 0.00;
new Fixed:y = 0.00;
/* We want to get the position on entity start up, so we use the Init function */
public Init(...)
{
/* We want to store, position for current entity to x, y variables. A empty sting access current entity, other wise you could use a entity ID to get it's position */
EntityGetPosition(x, y);
/* You can get the Display Object store on the map by using EntityGetSetting, more on that on next tutorial */
}
main()
{
/* Draw object to screen each frame frame */
GraphicsDraw("tutorial-sheet1.png:2", SPRITE, fround(x), fround(y), 1, 0, 0 ); /* See Scripting Interface for info on Draw Function */
}
This is a simple entity to get the entity position and to draw to the screen
Step 4
Now with the Entity created, you can now attach it to a display object on the map. Open up the Object's Advance Settings and check the entity check box, then select firstentity.mps