Users browsing this thread: 1 Guest(s)
Game Maker problem - collision and bouncing
#1
So I have some extensively annoying collisions in my game (not due to GM, though, but to my inability to well-ly program this stuff Tongue ) and I've posted this on two forums and haven't found a solution. Sad

It's a minigame, and four players are bouncing around on a spring mushroom thingy, and I want them to bounce off of each other. The thing is it's horrendously bugged, and they get stuck. A lot. They typically don't get stuck in the air, but they occasionally get spontaneously stuck to each other on the bouncer, and sometimes even 3-4 people get stuck simultaneously.
Anyone know how I can fix this?

info for player 1:
Code:
Information about object: objP1Bounce

Sprite: sprMarioBounce
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: <no parent>
Mask: sprPlayersBounceMask

Create Event:
execute code:

friction=global.bouncefriction


Step Event:
execute code:

if keyboard_check(vk_right) && hspeed>-global.bouncemaxspeed && place_free(x-hspeed,y)
{hspeed+=global.bouncehspeed}

if keyboard_check(vk_left ) && hspeed<+global.bouncemaxspeed && place_free(x+hspeed,y)
{hspeed-=global.bouncehspeed}

if place_free(x,y+1)
{gravity=1
gravity_direction=270}

else
{gravity=0}

if hspeed>global.bouncemaxspeed
{hspeed=global.bouncemaxspeed}

if hspeed<-global.bouncemaxspeed
{hspeed=-global.bouncemaxspeed}

if !(speed=0) {image_angle+=global.bouncespinspeed}

if vspeed>25{vspeed=25}
if vspeed<-25{vspeed=-25}


Collision Event with object objBouncer:
execute code:

//bounce off
if !place_free( x+0,y+1)
{move_contact_all(270,5)}

move_contact_solid(direction,-1);
move_bounce_solid(1);

//double vspeed because it's a trampoline
vspeed=vspeed*2
sound_play(sndBounce)

other.image_speed=0.25

Collision Event with object objP2Bounce:
execute code:

move_bounce_all(1)
instance_create(x,y,objClash)
sound_play(choose(sndBarrelDamage1,sndBarrelDamage2,sndBarrelDamage3))


Collision Event with object objBouncerBlock:
execute code:

move_contact_solid(direction,12)
vspeed=0


Other Event: Outside Room:
execute code:

move_wrap(1,0,1)

Player 2 is practically exactly the same, except a few AI discrepancies are thrown in. Players 3 and 4 are just child objects of player 2.

I have tried dozens of things, making them solid, unchecking precise collision checking, doing a circular mask, and nothing for me is working.
Thanked by:


Messages In This Thread
Game Maker problem - collision and bouncing - by FormerUser20 - 03-09-2012, 11:58 PM

Forum Jump: