Chaos Project

RPG Maker => Event Systems => Topic started by: G_G on September 27, 2008, 10:16:55 am

Title: Shooting System
Post by: G_G on September 27, 2008, 10:16:55 am
Ever wanted to make a shooting event system? First hang, i know I should be using the template, I used it for my script right?
Well first of all its 8 in the morning here and I stayed up all night playing on RMXP. And I am exhausted, if I can and remember I will apply the template later. Anyways here's the event code:
screenie: ShowHide
the demo will be slightly different.
(http://i307.photobucket.com/albums/nn318/bahumat27/Screenie-1.jpg)
heres the gun animation
(http://i307.photobucket.com/albums/nn318/bahumat27/gunfire1HandgunsSMG.png)


Event Code: ShowHide

Preperations:
First we need some variables: Hero X Hero Y Monster X Monster Y If you want more than 1
monster just make 2 more variables example:Monster 2 X Monster 2 Y Monster 3 X and so on.
Now make an event, choose a graphic and name it Monster.
Make a new animation that plays sound 89 and flashes target red on frame 1.
Need a few more variables too: hero HP monster HP
Now make one parallel process event and enter in the following data

ButtonInput:(just select a blank one)
Branch if [xxxx:blank] = 13
ControlVariables[xxxx:Hero x] set = to Player X
ControlVariables[xxxx:Hero y] set = to Player y
ControlVariables[xxxx:Monster x] set = to Monster X
ControlVariables[xxxx:Monster y] set = to Monster y
branch if Hero face down
  show animations:shoot down on hero
  branch if var[xxxx:hero x] = to [xxxx:monster x]
   branch if var[xxxx:hero y] less than [xxxx:monster y]
    ControlVariables[xxxx:Monster HP] + 1
    show animation Damage on Monster
   end
  end
else
  branch if hero face up
   show animations:shoot up on hero
   branch if var[xxxx:hero x] = to [xxxx:monster x]
    branch if var[xxxx:hero y] greater than [xxxx:monster y]
     ControlVariables[xxxx:Monster HP] + 1
     show animation Damage on Monster
    end
   end   
  else
   branch if hero face left
    show animations:shoot left on hero
    branch if var[xxxx:hero y] = to [xxxx:monster y]
     branch if var[xxxx:hero x] greater than [xxxx:monster x]
      ControlVariables[xxxx:Monster HP] + 1
      show animation Damage on Monster
     end
    end
   else
    show animations:shoot right on hero
    branch if var[xxxx:hero y] = to [xxxx:monster y]
     branch if var[xxxx:hero x] less than [xxxx:monster x]
      ControlVariables[xxxx:Monster HP] + 1
      show animation Damage on Monster
     end
    end
   end
  end
end

Now we're about done! In the event you named monster, set to event touch, make the frequency
high, and enter this in.

Show Animation Damage on Hero
Controlvariables:[xxxx:Hero HP] + 1
wait 4 frames

Now make a new page with the conditioning start with varaible[xxxx:Monster Hp] = or greater than 5
leave the graphic blank.
Now it will take 5 hits to kill the monster but same is for you! Make another
parallel process event that has this in it

branch if var[xxxx:Hero HP] = or greater than 5
Gameover
end

And ta-da!All is done! Oh and the screenie you see. Its part of my Halo Remake!
The demo will be different


demo: ShowHide
http://rapidshare.com/files/148831618/Project3.rar.html