Jump to content


Photo

falling brick issue


  • Please log in to reply
9 replies to this topic

#1 gamegear9

gamegear9

    GMC Member

  • New Member
  • 19 posts
  • Version:Unknown

Posted 02 July 2012 - 03:40 AM

I recently adopted a new (better) gravity method than my previous, nothing special but it works at least. I'm still pretty new to GM, so I can't figure out how to get the old bricks to fall on collision (while moving over them) without getting stuck to them. The bricks fall outside the map on collision. This is the player functions.

Player Step:
check empty, 0,1, solid, relative
set gravity 270, 0.5
else
set gravity, 270, 0
if var larger than 12
set vspeed 12


Platform collision:
move to contact, direction, -1, solid objects
set vspeed, 0


Old brick collision:
Check collision 0,1, solid
set vspeed, 1

Left keyboard:
check empty, -4, 0, solid, relative
jump to position, -4, 0, relative
check empty, 0,1, solid, relative


These are DnD actions just to be clear.

Edited by gamegear9, 02 July 2012 - 03:43 AM.

  • 0

#2 PrinceOthman

PrinceOthman

    GMC Member

  • GMC Member
  • 434 posts
  • Version:GM8

Posted 02 July 2012 - 03:53 AM

In the brick's STEP event put this code:
If instance_place(x,y-1,obj_player) {vspeed=1}

Ohh sorry. I just saw the drag and drop thing. Want me to make it DnD for you? Or can you just copy that as a code?

Edited by PrinceOthman, 02 July 2012 - 03:54 AM.

  • 0

#3 gamegear9

gamegear9

    GMC Member

  • New Member
  • 19 posts
  • Version:Unknown

Posted 02 July 2012 - 04:02 AM

In the brick's STEP event put this code:

If instance_place(x,y-1,obj_player) {vspeed=1}

Ohh sorry. I just saw the drag and drop thing. Want me to make it DnD for you? Or can you just copy that as a code?


I'm familiar with coding, just can't write them very well lol. It will still work the same right?
  • 0

#4 PrinceOthman

PrinceOthman

    GMC Member

  • GMC Member
  • 434 posts
  • Version:GM8

Posted 02 July 2012 - 04:10 AM

Yess but here's a better idea for you. Cause that will make them fall instantly.

If instance_place(x,y-1,obj_player) 
{
if alarm[0]=-1 {alarm[0]=n}
}
Change "n" as desired.

Now make an Alarm[0] event and in the even put
vspeed=n
Change "n" as desired.

This way it will take the time you put before it falls down. Anything else you need?
  • 0

#5 gamegear9

gamegear9

    GMC Member

  • New Member
  • 19 posts
  • Version:Unknown

Posted 02 July 2012 - 04:18 AM

Seems to be working fairly good, but how do I make the speed 'relative' in the code?
  • 0

#6 PrinceOthman

PrinceOthman

    GMC Member

  • GMC Member
  • 434 posts
  • Version:GM8

Posted 02 July 2012 - 04:23 AM

vspeed+=n
or

vspeed-=n

Put the +/- sign before the = sign to make it relative.

Edited by PrinceOthman, 02 July 2012 - 04:24 AM.

  • 0

#7 gamegear9

gamegear9

    GMC Member

  • New Member
  • 19 posts
  • Version:Unknown

Posted 02 July 2012 - 04:34 AM

It was working at first, now going over the bricks they just sit there...
  • 0

#8 PrinceOthman

PrinceOthman

    GMC Member

  • GMC Member
  • 434 posts
  • Version:GM8

Posted 02 July 2012 - 04:45 AM

What did you do?
  • 0

#9 gamegear9

gamegear9

    GMC Member

  • New Member
  • 19 posts
  • Version:Unknown

Posted 02 July 2012 - 05:37 AM

What did you do?


Nothing, it works sometimes but if I slide over them they don't always react.
  • 0

#10 gamegear9

gamegear9

    GMC Member

  • New Member
  • 19 posts
  • Version:Unknown

Posted 02 July 2012 - 10:06 AM

Okay, I've gone back to my old gravity. I just need to know how to make sure he doesn't get stuck to the walls in mid air... Keep in mind my game has old bricks that I can knock down if walked on or against.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users