I am new to unreal engine and I am trying to make a 2D game. The character is just a ball that will shoot bullets to cancel blocks. It’s just like space invader but the mechanics of the game is that the player should suck colors from different regions. Once you get the right color, you shoot the blocks with that color to cancel them. If you shoot the blocks with wrong color, you lose one health.
- The idea is simple, but how do I do this kind of judgement "if the block matches the color of bullet"? I tried to create a "getter" function to get color according to the flipbook that the bullet has (and assign an integer index to it). My idea is just use something like "theBulletInstance.getColor()" (I'm using blueprints to achieve this kind of thing) and compare the return value to the color in block which is save as integer index. This is how I normally get things in object-oriented programming languages like JAVA. However, it looks like i didn't seem to get the right object (bullet) in my blueprint. - How do I call the getColor function in the object that is in contact with the block and then make a judgement of the color match then decide if the block should be canceled? I tried to right click and put an Event ActorBeginOverlap while my bullet class is selected. But when I plug the "other Actor" pin to the target pin of my getColor function pin inside event graph of my block class, unreal tells me that Actor reference is not compatible with Shoot reference. ("Shoot" is the name of my bullet class.)
Any help will be appreciated!! Also, thank you for reading my post!