obj/rock
density = 1
Bump(M as mob)
src.Move(get_step(M,dir))
why dont that work?
ID:149687
Mar 7 2002, 2:11 pm
|
|
obj/rock why dont that work? |
Mar 7 2002, 2:15 pm
|
|
Because the rock doesn't Bump() the mob the mob Bump()s the rock.
|
In response to Nadrew
|
|
Another nice way to do it is to make a Bumped() proc.
atom/proc/Bumped() |
In response to Foomer
|
|
thanx Foomer. I did have some problems with my move code. it makes my rock go around in crazy ways. i want it to go away from me. like da rocks in MLAAS
atom/proc/Bumped() thanks for your time and help |
In response to MatrixMofo
|
|
MatrixMofo wrote:
thanx Foomer. I did have some problems with my move code. it makes my rock go around in crazy ways. i want it to go away from me. like da rocks in MLAAS Notice your arguments to get_step(): You're finding a step relative to the player (M)--not the rock--in the direction the rock is facing (src.dir). That should be get_step(src,M.dir) instead, since you want a step relative to the rock, in the direction the player is pushing. If you want the player to move too, you'll need to do this: Bumped(mob/M) This system is of course a little imperfect; the player's Move() proc will initially return 0 when they push a rock, because they bumped into the rock; however once Bump() is called, they'll be moved anyway. Thus if you have any routines that rely on a player's Move() proc returning 1 if they can push a rock, they'll fail. Fortunately this is a minor problem and the code you have on hand should be a good place to get started. Lummox JR Lummox JR |
In response to Lummox JR
|
|
The order that bumping is done made me disturbed first time I read its define in the reference, this should obviously be a built in function, and all blocking objects should have Bumped() called in them until one refuses to budge (returns 0) 'before' the Move() fails...
Hmm, guess this could work too...? turf Enter() for (atom/moveble/a in contents) if (we can co-exist with this moveble) continue if (!a.Bumped()) return ..() return ..() Perhaps...? Just a guess, Im kind of newbie to Byond... |