Hey dude, two things, what does the print string before the branch say? As in is that getting fire or not? And two, can you provide a better resolution diagram? Thanks.
I seem to have noticed there have been a few inquiries to the fighting game threads I have made through the years. Perhaps I picked the wrong template to spend the most of my time on? The ambitious idea originally was to make a series of templates within Unreal Engine, for example a fighting game (Mortal Kombat, Street Fighter, Killer Instinct, etc etc) a ship scroller (U.N. Squadron, Gradius / LifeForce, R-Type, etc etc). and a beat em up (Double Dragon, TMNT, Golden Axe, Final Fight, P.O.W, etc etc). The beat em up I have spent the most time in and got the furthest, conversely I am thinking now it may also be the most difficult. As it is essentially a 2.5 D game, sure they are all 2D games at the end of the day. Probably the next most diffcult would be the fighting game. Although in a local multiplayer way perhaps easier if it did not have a single player and you didn’t have to worry about enemy movement behavior (EMB). Case in point would be Mortal Kombat 2. Lets say you are facing off against Liu Kang controlled by the CPU. As soon as the computer allows you to move what will he do? Block? Bicycle kick (time charge move)? An upper fireball? A lower fireball? A flat foot jump kick (a good defense in fighting games imho)? A forward jump kick? Will he advance on the player? Will he do nothing? Add that up, that is eight possibilities. Get a random int in range, set the range from 0 to 7 (because in programming it seems you start counting from zero in many cases), drag out from that and choose a switch on int, add the zero to seven pins, there is an eight way random possibilty every time it receives a single pulse.
It seems like you set the if branches in a way where if the first IsOverlappingComponent is false, then the If Branch for when its true never fires the next If Branch. I would just simplify it into one If Branch if you are just using P2 A Box for both of them (the resolution makes it hard to see). If its P2 A Box and P2 B Box, I would just connect the if branch when P2 A Box is True to the other if Branch as well.
That seems to be the thing in Unreal, there are many ways to do to accomplish the same thing. Think when I first tried to achieve it I was using some wonky method with box collisions. I also can’t make out enough of the diagram to offer an opinion.
Its been a minute since I made that thread but lets see here. First get references to both characters. In this case like old side scrollers and beat em ups they are either going to be facing right or left at all times. So you only want movement on the Y and the Z axis (when you jump). You need a fast firing and constance source like the Event Tick. Get your refs, get your mesh, find world location, IF the other player’s Y exceeds or goes below your Y then you need to set actor rotation, on the Z. Throw some numbers out and see what happens -90…..90……180……-180. And adjust accordingly. And like you said, it should be able to be done with one branch. But since it is a fighting game you will have to make the other character also flip in the same way. So that the character’s are always face to face.
is there something wrong with my character blueprint itself? it seems like everytime it turns around a huge phantom collision appears on the back of it even though i set the arm hitbox to not collide
please show me an example blueprint? i’m new at this and english is not my first lauguage
Hard to read screenshot, but it looks like it’s checking the same overlap twice, so both would fail if the first does.
Instead of checking overlap for multiple boxen. you could just find the look at rotation , and use a dot product check against the foward vector to see if they’re close.
A return of 1 from dot product node means vectors are the same, so .8 is within like 18 degrees.
your solution worked, but since i’m using flipbooks, the rotation causes tearing. how can i adapt this to flipbook logic?
Maybe have a second branch before setting rot and if look at is > 0, set rot yaw to 90, else set to -90. The final rot would depend on which axis your camers is aligned to. Could be some slight non perpendicular rotation angle is causing the flipbook to break? Or maybe use relative rotation on flipbook comp. I’ve not used flipbook feature very much.
i think it’s because i’m using event tick to call the function and event tick updates too many times and causes the tearing, don’t know how to solve it. tried to use event begin play + call timer by function but it only called the function one time and i want the function to be called everytime one character exceeds the y of another, but at this point the code is just becoming redundant
Instead of using set actor rotation, try using Set Control Rotation to point left and right. Then in character movement component, tick the option to Use Controller Desired Rotation, and set the z rotation rrate something high like 1000. The AI or player controller will immediately snap left and right that way, and the movement comp can handle rotating the sprite.
The less than check heading into branch there is from my x move input, but it should be fine in a tick even too, since enhanced input basically happens on tick ( give or take a ms or 2 depending on hardware polling lol).
actually the solution didn’t work. just caused my character to arbitrarily flip while giving the illusion of looking at opponent because of sprite tearing