In my last blog I went over the players movement but I forgot to add 2 things. Which is mirroring which makes the player look normal when he faces the other way other wise when he moves backward he is still looking forward. So to do this we will need these two pieces of code.
That way when left arrow key is pressed he is mirrored and when right arrow key is pressed he will be un-mirrored. And in game it will look like this.
And this would be how it looks Un-mirrored
So now whichever way the player is going he looks that way. Now that that’s out of the way lets get started with the Enemies movement.
The first thing e need to do is ensure the enemies only start moving once we can see them as that is how the enemies moved in the original Mario game so we want to mimic that. And luckily this very easy with construct.
This is extremely important code that can be messed up very easily. So first we add the event “enemies is on screen”. Next we right click on this event like this.
Once you have right-clicked on the event it should show add then hover over it and once it shows up click on add sub event. This will cause the next piece of code to basically be indented which allows another event to go below it as a sub event.
This sub event will be “enemies is mirrored” and the action will be “simulate platform pressing right”. Once this is done we will need to add another sub event which will be “Enemies X is mirrored”. Which if you remember from I believe my last post the big red X in front of the code means it is inverted. The action will be “simulate platform pressing left”. This will make it so that when the player sees the enemies they will start moving but if they run into something they will stop. This is where our next piece of code comes in handy.
Our next Piece of code will also use sub events and a new type of code but we’ll get to that in a second first I’ll show you what the code looks like.
This code will allow the enemies to change direction when they are stopped. So first off we need to dd our main code piece which is “Enemies Platform on stopped”. From there we will need to add a sub event not 2 this time. Our sub envent will be “Enemies is mirrored” and the action will be “set Not mirrored”. But now instead of wasting lots of time and energy adding another sub event simply click on the “Enemies is mirrored” code. Like this
Then hit “x” on your keyboard and it will add a “System else” code and then you add a set “mirrored action” and thats it. I’ll show you what it should look like.
Thank you for reading this blog check out my Yt channel @Drago Gaming link: https://www.youtube.com/channel/UCrlNUqQVBxLIbdltHQBdcYg?view_as=subscriber
And as always with this set of blogs Huge thanks and shoutout to Gamegen and Raymond Roque for all their help with this difficult project without your help I would have had a really hard time completing this project so thanks so much.