BearBearBear Dev Diary – #2

Today I set up:

  • an array to track the reels of the slot machine
  • random generation for the results
  • a calculation for how much each reel needs to spin
  • some basic test visuals

My main trouble was trying to figure out how to call a subroutine from a different script. All the code I’ve done so far has been on the GameMode but I want to handle the rotation of the reels in the their script. So I needed to figure out how to find the reels actor, cast that to the reels class and then call a subroutine within the reels class. After much Googling and experimenting I managed to figure it out and now I can move onto coding the calculation for each turn for each timeline update and then applying that turn to the reels. My knowledge of Unreal Engine and Blueprints really helped me out today as I knew what I needed to do and how I wanted to go about it, I just didn’t know the C++ for it.