Adding Events To Player (Part 6)

Adding Events To Player (Part 6)
Adding Events To Player (Part 6)

Welcome once again guys ! So we have added behaviors to our player in last tutorial and if you guys miss that tutorial (then click here) , and if do not miss that tutorial then you are good to go. So now we are going to add some controls (Events) to our player so that player can look at the mouse position and also giving ability to our player to shoot. So let’s get started.
Adding Events To Player

You guys will see an “Event tab (Event sheet 1)” right after to "layout 1" tab (If you don’t see it then simply click on “Event Sheet 1” at the right side).  Once you open “Event Sheet”, you will a blank window which is actually “Event Sheet”. For adding events click on “add event” or simply double click in “Event Sheet”. Now you will see a pop-up window which will have different images as well as “System”.

Adding Events To Player (Part 6)
Adding Events To Player (Part 6)

Click on “System” and then click on “Next”, now you will see many “Events”. Click in search bar and type “Every tick”, before we move to next event let me explain what is “Every tick”. Every tick is just a milliseconds of one second. It means 60 milliseconds per-frame. 
Adding Events To Player
Adding Events To Player (Part 6)
Finally click on "Done". Before we do any thing else, first of all go back to level 1 tab and right click any where, and click  on “add new object “.  This time click on search bar and type “Mouse”. Add mouse and wait for 5 seconds, once you done with that, now you are good to go.
Adding Events To Player (Part 6)
Add action
Once you add “Every tick”, then you will see “add action” right after to the “System>Every tick” or see above image. Now click on “add action” and you will see new pop-up window (again). This time click on player and then click on “Next”, now click on search bar and search for “Set angle towards position”. Select that and click on “Next”, here you will a new window having x-axis and y-axis parameters. Add “Mouse.X” and “Mouse.Y” without quotes in X and Y parameters respectively. And now run your game, you will see our player is looking at mouse position properly. So Congratulation guys our player is going on the right spot.
So that’s it for this tutorial and if you have any question please leave your comment without any kind of hesitation.

Share this

Related Posts

Previous
Next Post »