Charas-Project

  • Home
  • Help
  • Search
  • Calendar
  • Login
  • Register
*
Please login or register.

Login with username, password and session length
 

News:

New forum theme up and running!



  • Charas-Project »
  • Game Creation »
  • Requests »
  • Tutorials »
  • Shooting System!
« previous next »
  • Print
Pages: [1]

Author Topic: Shooting System!  (Read 2220 times)

Offline benjie417234

  • Member
  • Initiate
  • *
  • Posts: 74
Shooting System!
« on: November 13, 2007, 10:36:05 AM »
Okay here it is!

First I make an event that activates the shooting range detection. I make a switch that will activate this detection. I make a new page and check it with the switch.
I make four variables: Hero X, Hero Y, Other X, and Other Y. Hero X is set to the Hero's position according to the X axis. Hero Y is for Y axis. Same with the Other variables only they are for the "enemy" sprite/event.
After that I make a Branch Condition on whether the enemy sprite is facing "up." If it is so, I make another Branch inside the other Branch asking if Hero X is equal to Other X. If that is so, then I ask is Hero Y is LESS THAN Other Y. If so, make the event within the branch expressing the damage done.
For the other way around it's simple. If the enemy is facing down, just do the opposite, meaning that you do "Hero X equals Other X?" and then you ask if OTHER Y IS LESS THAN HERO Y. If that is true, do the damage event.
For horizontal direction, it's not very hard.
First I ask if the enemy is facing left. Then ask if Hero Y is equal to Other Y. If so, I ask if Hero X is less than Other X. If that is true, do the damage event.
For the other way around you do this:
Ask if enemy is facing right. Then ask if Hero Y is equal to Other Y. If so, I ask if Other X is less than Hero X. If it's true, do the damage event.

Well, that's it. I tried to explain my best, and that usually doesn't work out. :P

I think you get it now hehe.
Logged

  • Print
Pages: [1]
« previous next »
  • Charas-Project »
  • Game Creation »
  • Requests »
  • Tutorials »
  • Shooting System!
 

  • SMF 2.0.10 | SMF © 2015, Simple Machines
  • XHTML
  • 2O11
  • RSS
  • WAP2
  • Simple Machines Forum