Remember me
You are here: HomeForum
Welcome, Guest
Username: Password: Remember me

TOPIC: [Game Entity] Trigger Block Example

[Game Entity] Trigger Block Example 1 year 1 month ago #3151

If you want to trigger events depending on the player's location, or if the player is in radius to interactive objects in the level you're making, here's a good example on how to do so.

In this example, every time you restart the game, the trigger will be a different size. This shows how accurate the trigger's detection is of the player. Use the arrow keys to move and rotate the player.

www.gamemaker3d.com/player?pid=052615664073


Cyberix3DPlayer_S0fDMlm9nT.jpg



Unlike other engines, Cyberix does not have a dedicated trigger code block. An old method I personally used was to check if the player was colliding with a cube, trigger the event I wanted to happen, and disable collision. Obviously there are problems with that old method, for example there was a noticeable invisible object that the player was touching and that ruins the experience no matter how subtle it is, and there was really no good way to reactivate the trigger and reuse it.

So I came up with a solution. I took a cube, disabled the collision, and calculated if the player's xyz was greater & lesser than the cube's xyz + width, height, and depth. If it was neither greater or lesser, then trigger the event (in this case the text).

The code works but it'll be very tedious to create them from scratch and put so many throughout a level, especially if you want to alter the code, since you'd have to alter it for every individual trigger.

Hopefully there is a more simplified/optimized solution in the future, have fun developing!
Last Edit: 1 year 1 month ago by Symbiotic Interactives.
The administrator has disabled public write access.
The following user(s) said Thank You: cyberix3d
Time to create page: 0.107 seconds