ID:165733
 
How do you make an object move in a direction as long as something solid is beneath it then "fall" until it enters a certain area.

The idea is to have it act exactly like a mushroom from Super Mario Bros. Which is what the object in my game is.

I know how to do projectiles but that wouldn't apply here. Any solutions?
as it moves check the next tile over and below it. If it is solid, it still moves across, if not it moves across then down. I've done something similar in which a projectile goes in a direction till it hit's something, then it bounces off. Opposite example, but same idea.
Hm, something like this perhaps?
obj/Wheee
verb/Push()
walk(src,EAST) //keeps walking east until the proc is stopped, which is below

Move()
..()
var/turf/T = src.loc
if(T.value=="hole") //assuming we have a special variable to define it, or you can look for it's path, etc etc etc
walk(src,0) //stops the walking procedure


Like what Jik said >_>

- GhostAnime
In response to Jik
I understand the concept of it but how do you check below an obj or next to it, because that could help me out with many many things.
In response to KirbyAllStar
Well, let me make an explination for [link]

This is the hierarchy in the system of BYOND (make be a bit incorrect):

/datum
--/atom
----/area
----/turf
----/movable (/atom/movable)
------/obj
------/mob

X.loc refers to the containers holding X, which GENERALLY (not always) is an object below.

/area holds /turf and whatever /turf holds.

/turf holds /atom/movable types.

/atom/movable types usually don't hold anything by default.



If an object was on the ground, than the .loc would be the turf it's on. However, if it was in a mob, than the .loc would be that mob which the .loc of that mob would be a turf (if it was there).

---

To get the objects beside/in-front of, I suggest get_step()

- GhostAnime
In response to GhostAnime
by under I meant south of the obj so if there was a platform it was moving on and the platform ended, it would fall down and keep moving then bounce off any dense objs

and how would I make the walk() go slower?
In response to KirbyAllStar
In the reference for walk(), it states theres a delay option, just increase that amount to like 10 for 1 sec. delayed movement, etc.

For getting the opposite direction, one method would be to use turn():
#define oppdir(mob/X) turn(X.dir,180)


180 degrees of NORTH is SOUTH, and well, you get the idea (this is a good idea to use with what Jik mentioned above).

- GhostAnime
In response to KirbyAllStar
KirbyAllStar wrote:
by under I meant south of the obj so if there was a platform it was moving on and the platform ended, it would fall down and keep moving then bounce off any dense objs

and how would I make the walk() go slower?

Ghost took care of the slow down, as to the check below, use get_step() to check the Southeast (or Southwest) turf. if it is a solid turf, move East. If it is not, then move Southeast.