Forum rules - please read before posting.

Changing the Cursor through Code

Hello!

I'm a programmer working on a first-person shooter title where we are using UCC to handle the core mechanics and then AC for game loop and various other things. As of right now, we have AC controlling the cursor including for crosshairs during gameplay. However, I need to be able to change the cursor when, say, you look at an enemy or for a few other things as well.

As far as I can tell, AC doesn't really expose much for the Cursor in terms of code for doing something like this. So, I'm wondering if it is possible to change around the cursor in this manner without having to mess with AC's code directly? I could handle the cursor myself outside of AC but it is just nice to use it since it already handles stuff like looking at Hot Spots and the like.

So, if there is maybe a tutorial out there for something like this or some location that goes into more detail that would be great!

Thanks!

Comments

  • Do be aware that use of AC's cursor system is entirely optional. Particularly if you're using it in conjunction with another gameplay asset, you may find that the best option is to disable it and rely on your own custom cursor system. To do that, you can use the Engine: Manage systems Action.

    But you can certainly change the cursor through code - which are you looking to change? The Main Cursor?

    You can get an API reference to any Manager field by right-clicking that field's label (or texture slot, in the case of texture fields). You can then use that API reference to change its value through script. In the case of the Main Cursor graphic, it's:

    AC.KickStarter.cursorManager.pointerIcon.texture
    

    Though, in the case of cursors, it's typically best to call ReplaceTexture instead - as this will clear internal sprite/animation caches as well - i.e.:

    AC.KickStarter.cursorManager.pointerIcon.ReplaceTexture (myNewTexture);
    
  • Awesome! Thanks for the help!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.