PlaceholderGames / Group-E-Ass2-Game

Ass 2 repo for Group E
0 stars 0 forks source link

Movement #15

Open MichalPiechowiak opened 6 years ago

MichalPiechowiak commented 6 years ago

Making character movement (a, w, s, d)

First of all we need to go to the project settings which can be found under 'Edit' bar in bar menu. As we get to the project settings we will need to find input and under the 'Bindings we need to create 2x'Axis Mapping' which will allow as to set on which axis our character will move and how. In each axis map we need to have 2 boxes for input (for forward and backwards W and S)(for left and right A and D). Then we need to change the 'Scale' of some inputs as all are by default set to +1 we need 2 of them to be set to -1 (these are for S and for A as they are moving in the negative direction of the axis) as shown below. image Now we need to create a new blueprint for character, as well when we create a character blueprint we need to remember to add flip book to add the 'character look' as we are doing 2d game while the program by default thinks that we are going to create a 3d mesh. Below you can see the blueprint needed to make character move. image So first of all we are using to events which we had created in project settings under the input. Then we need to add movement input and connect it to our event. now we need to add get vector (for forward and backward we need forward vector and for left and right we need right vector). At last we are adding get control rotation. Now when the blueprint is finished we need to create a new game mode it can be done by going to Blueprints bar, then in side blueprint select what's under project settings and then press create and at last choose 'GameMode'. (We need to do that to change the default character - inside the GameMode find the default paw class and change it to your character). image image So the last step is to make a camera which will follow our character. to do so we need to press twice on our character blueprint and to character self add 'SpringArm' and then 'Camera'. Then we need to adjust the camera. So it look like example below: image Now we can go to play mode and see if it worked, the result should look like picture below: image In the middle we suppose to have a character sprite but at the time I was creating character movement I didn't had any picture on my PC.

SheDemon commented 6 years ago

There you go. I finally finished animation of the pieces I made when I got inspired by Lois. Its on transparent background so we can easily use it. It's just one guard but it a start and It's gonna be easy to make the rest of the characters. Until I find out how to put it right in the UE there is the link. LINK TO THE SPRITES animation

SheDemon commented 6 years ago

animation2 There is the recolor for different type of guard.

MichalPiechowiak commented 6 years ago

Hi guys. I had created a rotation to the character. So we can walk and rotate character (that will change where is front and where is back (it will rotate it) etc.) so what we do is similar to movement shown above, we need to go to project settings and go to input where we create another axis and make it so it acts when mouse's x is changed as show below image Then we go to blueprints and we are calling the event that we created inside inputs. Then we attach it to Add Controller Yaw Input (I think that it mean rotation o z axis) as shown below. image So what I had created will rotate the camera together with the character. To change it we need to open character blueprint and press on the component called Spring Arm and under camera settings we need to untick Inherit Yaw what will make so character is rotating but not camera doesn't. image Only drawback with this method is that we cannot see the mouse cursor, as we are rotating using only mouse's x the mouse cursor will move only side ways and it will look dumb if we make the cursor visible. I will try to improve it later on when more features are completed.

16079582 commented 6 years ago

Movement doesn't work when switching from main menu to the main levels.