Functions available in this pack:
- Playtime
FillColorCanvas
SmoothMovement
ChangeColor
Visible
SaveFile
LoadFile
- Code: Select all
// FUNCTIONS - Craig Ramsey//
// Welcome to the list of functions View the readme file
// I made using Game Editor, these for information on how
// functions are easy to use, enjoy. to use these functions.
// Defines
#define true 1
#define false 0
// INT variables
int framecount;
int temp;
int i;
int seconds;
int minutes;
int hours;
int fps = 30; //Set your framerate here.
//Char variables
char *key=GetKeyState();
void Playtime()
{
framecount = framecount + 1;
if (framecount == fps * 3)
{
framecount = 0;
seconds = seconds + 1;
}
if (seconds == 60)
{
minutes = minutes + 1;
seconds = 0;
}
if (minutes == 60)
{
minutes == 0;
hours = hours + 1;
}
}
void FillColorCanvas(int r, int g, int b, int transparency)
{
erase(r, g, b, transparency);
}
void SmoothMovement(int distancex, int distancey, int speed)
{
MoveTo("Event Actor", distancex, distancey, speed, "Event Actor", "");
}
void ChangeColor(int rh, int gh, int bh)
{
r = rh;
g = gh;
b = bh;
}
void Visible(int ifvisible)
{
if (ifvisible == 0)
{
transp = 1;
}
if (ifvisible == 1)
{
transp = 0;
}
}
void SaveFile(char * filename, char str[255])
{
FILE*file;
file = fopen(filename, "w+b");
fwrite(str, sizeof(file), 1, file);
fclose(file);
}
void LoadFile(char * name, char * store)
{
FILE*file;
file = fopen(name, "r+b");
fread(&store, sizeof(store), 1, file);
fclose(file);
}