Giving Your Character Shooting Properties

Giving Your Character Shooting Properties

<p> GAME MAKER TUTORIAL #6 Giving your character shooting properties</p><p>1) Open your previously made Platform game. 2) Create a bullet spite with the sprite that is available from Wiki (calling it ‘spr_bullet’). Make this into an object (‘obj_bullet’). 3) You need to set your character up to fire a bullet. In order to do this, your character needs a variable to know which way it is facing. Go to your character’s Object Properties > Create > Set Variable Action from the Control tab. Set the Variable as ‘facing’ and Value as ‘0’. The direction the character is facing will be remembered in angles (right being 0 degrees, up 90 degrees, left 180 degrees and down 270 degrees). When we fire the bullet we will tell it to move at the facing angle.</p><p>We need to set the facing angle when your character changes direction. We will do this on your keyboard right and left events. To set facing direction: 4) On your character’s left keyboard event, use the Set variable action from the control tab. Set Variable as ‘facing’ and Value as ‘180’. Complete the same steps for your right keyboard event, but make the Value ‘0’.</p><p>To fire a bullet 5) Now we have set the facing direction, you can use the angle to aim the bullet. Go to Add Event > Key Press > Space. From the main1 tab, use the Create moving action. Set the Object as obj_bullet, X & Y as ‘0’, speed as ‘15’, direction as ‘facing’ and tick relative.</p><p>6) Test your game now. You should find that your character fires bullets when you press the space button.</p><p>7) You will need to add a Collision event with the wall that causes the bullet to destroy. You can also now add targets to shoot at to gain points.</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    1 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us