TD Car Collisions and shooter aiming

Posted by Zac1790 on July 8, 2006, 12:45 p.m.

These are really rare but look at this:

This is angle correction outward style.

a = point_direction(x,y,other.x,other.y)

b = image_angle;

d = b - a;

faceprev = image_angle

if(d < 180){

if(b > a) then image_angle += 10;

if(b < a) then image_angle -= 10;

}

if(d > 180){

if(b > a) then image_angle -= 10;

if(b < a) then image_angle += 10;

}

if(image_angle>360){image_angle-=360;}

if(image_angle<0){image_angle+=360;}

so the car lines up with the wall. I'm thinking it should have a not-sprite mask. Or you could just do it with direction for less fancy stuff.

For 2D shooters here's inward angle correction…

// it's for enemy's guns to slowly aim

// you can change the 10s to whatever you want for

// the speed of aiming

a = point_direction(x,y,mouse_x,mouse_y)

b = image_angle;

d = b - a;

faceprev = image_angle

if(d < 180){

if(b > a) then image_angle -= 10;

if(b < a) then image_angle += 10;

}

if(d > 180){

if(b > a) then image_angle += 10;

if(b < a) then image_angle -= 10;

}

if(image_angle>360){image_angle-=360;}

if(image_angle<0){image_angle+=360;}

-Zac1790

Like my new banner?

Penguin Dude made the first one… but I got attacked by JakeX so I made this one.

Comments

noshenim 18 years, 4 months ago

I don't like the font in your banner.

Alx 18 years, 4 months ago

Hey Zac give credit and he chose the font so yeah.

Zac1790 18 years, 4 months ago

Yeah, penguin dude did it.

I just chose a font…

The name looked good to me…

Just not the rest.

I guess that's proof that everyone only reads the last sentence.

Requiem 18 years, 4 months ago

I could make a better banner in 20 seconds.

(See the user Scythetastic)

Zac1790 18 years, 4 months ago

:O

Well…

I tried the code in DesertFox's skidmark example with 10's at 45 and image_angle as dir.

It works great. It's like a slight bounce type thing, based on your speed. It might be better at 30…hmm.

Zac1790 18 years, 4 months ago

Scythetastic's doesn't show wips and games…

COOL MAKE ME ONE!!!

Oh, wait… I can do that stuff myself… lol I'm great at photoshop… Just didn't think of that as a banner… looks like a name.

Zac1790 18 years, 4 months ago

I know this is my 3rd comment in a row but there it is.

I tried something different and it ended up like that.