gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Riding on a monster or a platform

#6110 - sgeos - Sat May 17, 2003 7:12 am

Generally speaking, what is the best way to implement entities in a game, be they platforms or cars or flying turtles, that a player character (or other critter) can ride on?

-Brendan

#6126 - tepples - Sat May 17, 2003 8:24 pm

sgeos wrote:
what is the best way to implement entities in a game, be they platforms or cars or flying turtles, that a player character (or other critter) can ride on?

Give the walking actor class a member called "footing" that points to another actor, and make Alice->footing point to the last actor that Alice stepped on, or NULL for the feet on the background.

(Replace "class" with "struct" when using plain C.)
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.