Script
Game Editor implements a C-like script language that allows a high level of development
power and flexibility.
All Actions can be activated from scripts.
When selecting an Action Function in "variable/functions" list, the respective
action dialog pops-up to allow auto completion of the script.
Internal variables: | double
musicVol; //Music volume (0.0 - 1.0) //Read Only int frame; //Game frame count int real_fps; //Real game frame rate (frames per second) int xmouse; //Mouse x position (screen coordinates) int ymouse; //Mouse y position (screen coordinates) |
Internal structs: |
typedef
struct stActorVars
} Actor; |
Internal collide Actor: | Actor collide; |
Action functions: |
int ChangeAnimation(char *actorName, char *animationName, int state) Change
animation and set initial state (FORWARD, BACKWARD, STOPPED, NO_CHANGE). animationName:
animation valid for actorName. int ChangeAnimationDirection(char *actorName, int state) Change
animation state (FORWARD, BACKWARD, STOPPED). Actor
name: int ChangeCursor(char *actorName, char *imgName, int nFramesH, int nFramesV, int hotSpotX, int hotSpotY) Change
Actor cursor. Actor
name: int ChangeParent(char *actorName, char *parentName) Change
Actor parent Actor
name: int ChangePath(char *actorName, char *pathName, int axis) Change
Actor path and set axis (X_AXIS, Y_AXIS, BOTH_AXIS). Actor
name: int ChangeTransparency(char *actorName, double transp) Change
Actor transparency (0.0 - opaque, to 1.0 - transparent). Actor
name: int ChangeZDepth(char *actorName, double zdepth) Change
Actor z depth. Actor
name: int CollisionState(char *actorName, int state) Enable
or disable collision (enable = 1). Actor
name: Actor* CreateActor(char *creatorName, char *animationName, char *parentName, char *pathName, int xpos, int ypos, int absolutePosition) Create
new Actor. int CreateTimer(char *actorName, char *timerName, int milliseconds) Create
new timer. timerName:
new timer name. int DestroyActor(char *actorName)
Destroy Actor Actor
name: int DestroyTimer(char *timerName) Destroy
timer timerName: timer name int EventDisable(char *actorName, unsigned long event) Disable
Actor event: Actor
name: int EventEnable(char *actorName, unsigned long event) Enable
Actor event: Actor
name: int FollowMouse(char *actorName, int axis) Make
Actor follow mouse axis (X_AXIS, Y_AXIS, BOTH_AXIS, NONE_AXIS). Actor
name: int MoveTo(char *actorName, double x, double y, double velocity) Move
Actor to specified position, at specified velocity. Actor
name: int PhysicalResponse(int moveType, int massType, double massEventActor, double massCollideActor, double eventVelocityMultiplier, double collideVelocityMultiplier) Do
a physical bounce movement between Actors in a collision moveType:
MOVE_EVENT_ACTOR_ONLY, MOVE_COLLIDE_ACTOR_ONLY, MOVE_BOTH_ACTORS massType:
USE_CALCULATED_MASS, USE_SPECIFIED_MASS massEventActor,
massCollideActor:
int PlayMusic(char *soundPath, double volume, int loop) Play
a music file. Note: The musics must be copied to specified path. int PlayMusic2(char *soundPath, double volume, int loop, int priority) Play
a music file. Note: The musics must be copied to specified path. int PlaySound(char *soundPath, double volume, int loop) Play
a sound file. Note: The sounds must be copied to specified path. int PlaySound2(char *soundPath, double volume, int loop, double pan) Play
a sound file. Note: The sounds must be copied to specified path. int ToAnteriorPosition(char *actorName) Send
Actor to anterior frame position. Actor
name: int VisibilityState(char *actorName, int state) state:
ENABLE, DISABLE and DONT_DRAW_ONLY (Don't draw, but allow events) Actor
name: |
Drawing Functions: |
Drawing Functions must be used into actions of a canvas Actor. void setpen(int r, int g, int b, double transp, int pensize) r: red component (0 - 255) void moveto(int x, int y) void lineto(int x, int y) void putpixel(int x, int y) void erase(int r, int g, int b, double transp) r: red component (0 - 255) void screen_to_actor(int *x, int *y) void actor_to_screen(int *x, int *y) void savecanvas() void restorecanvas() |
Sound functions: |
Sound functions uses the channel returned by PlayMusic, PlayMusic2, PlaySound, PlaySound2 void setPan(int channel, double pan) void setVolume(int channel, double volume) void stopSound(int channel) |
Save functions: |
void saveVars(char *file, char *group)
|
Helper functions: |
double radtodeg(double a) int
getLastKey() char
*getKeyText(int key) void
remapKey(int fromKey, int toKey) char
*GetKeyState() Valid key entries: KEY_BACKSPACE int ExitGame() End
game and return to system. int LoadGame(char *gamePath) Load
a game. int ActorCount(char *actorName) Return number of Actors with actorName. Actor
name: int CollisionFree(char *actorName, int x, int y) Check if position x,y is collision free for ActorName. Return 1 if not collide, 0 otherwise. Actor
name: int SendActivationEvent(char *cloneName) Send
a Activation Event to Actor cloneName. cloneName: nameactor.cloneindex (Ex.: ship.1, ship.2, ...) Actor *getAllActorsInCollision(char *cloneName, int *nActors) cloneName: nameactor.cloneindex (Ex.: ship.1, ship.2, ...), "Event
Actor" or "Collide Actor" The returned array will be valid until the next call to getAllActorsInCollision Sample: Make "Event Actor" the parent of all colliding Actors int n; if(actors) { int i; for(i = 0; i < n; i++) { ChangeParent(actors[i].clonename, "Event Actor"); } } |
Internal C functions (Please, refer to C manual for more info): |
double
abs(double a) long
ftell(FILE *fp) char
*strcpy(char * dst, const char * src) |