Download

Creating global level variables and using Cast to Game Mode

I’m trying to create and a global variable to control the direction of enemies in a Space Invaders clone.

I’ve set up a variable in the Game Mode to control the direction when one of the enemies hits the border of the screen, the direction needs to flip between -50 and +50.

In the “Enemy” blueprint, I’m trying to get the value of the Game Mode enemy_direction variable, but I get a Blueprint error saying that “the type of Object is undetermined. Connect something to Cast to SideScrollerGameMode to imply a specific type.” Can you point me in the right direction? I don’t know what to connect the object to.

Thank you for your help!

-Dan

Never mind - I figured out the problem - I just had to get current game mode and ‘plug’ that into the object.

Thanks,

-Dan