Hi, I’ve started creating my first game. Really all I need right now is stuff with richochet. I had some code from a book from Jobe Makar, but it was long and confusing. Here’s the code i’ve got so far, all i need is the actual bouncing of the bullet, at an angle.
if(b.hitTest(CrumblingWall))
//b = the bullet
{
trace(“The bullet hit the wall… Checking for richochet”);
richochetCheck = Math.round(Math.random()*10);
if (richochetCheck >= 5)
{
removeMovieClip(b);
trace(“No richochet”);
}
else
{
trace(“Richochet”);
}
Lol. Ok, thx Nich. There’s another little problem if you’d be willing to help out. The bullets simply won’t make more than one at a time. As in if I fire it will move well enough but if i fire again that last bullet shot dissapears and another one appears at the tip of my gun. Except when I die, It shouldn’t let me shoot, but when it does it works right. It’s very strange.
onMouseDown = function () {
var b = attachMovie(“bullet”, “bullet”+depth, depth++);
b._x=MainHero._x, b._y=MainHero._y;
b._t = Math.atan2(this._ymouse-b._y, this._xmouse-b._x);
b.onEnterFrame = function() {
this._x += Math.cos(this._t)*9;
this._y += Math.sin(this._t)*9;