SetOnGenSpriteBoundsSub sprite, onBounds()

Sets the on boundary crossed subroutine for the specified sprite. Once set, the specified onBounds() subroutine will be automatically called when the sprite crosses a boundary.

include "Game Engine"

'...Turn on the game engine and init a sprite...

SetOnGenSpriteBoundsSub sprite, onBounds()

GenSetGlobalBounds width, height, Edge_Kill_Sprite

'...continue with program...

Sub onBounds(sprite, edge)

End Sub


The Game Engine sprite object. This is the sprite that triggered the event sub.


This event sub is triggered by when a sprite crosses a boundry. The Boundry may be global to all sprites or local to the sprite that triggered the event. The edge parameter tells you which boundary was crossed.

From the Game Engine file. This include file is located in the global include directory and may be used by any Basic program.

' Boundary Mode
Const Edge_Do_Nothing = 0
Const Edge_Kill_Sprite = 1
Const Edge_Wrap = 2
Const Edge_Rebound = 3
Const Edge_Stop = 4

' Global Boundary Hit
Const Edge_Left = 0
Const Edge_Top = 1
Const Edge_Right = 2
Const Edge_Bot = 3

' Local Sprite Boundary Hit
Const Sptite_Edge_Left = 4
Const Sptite_Edge_Top = 5
Const Sptite_Edge_Right = 6
Const Sptite_Edge_Bot = 7

SetOnGenSpriteBoundsSub sprite, Off

Turns off the automatic subroutine call.



Game Engine Events

Event Triggered Subs

Become a Patron