Scrolling Game Development Kit Forum
SGDK Version 2 => Help, Errors, FAQ => Topic started by: Tanja on 2007-11-28, 05:23:01 AM
-
my player carries a bag which is an extra sprite. is there an easy way to say: the bag is a child sprite, so it moves exactly like its parent? even if the parent is blocked by a wall, the child is also blocked, despite there is no touching of child collision rec and wall.
-
If you create a Plan, you can add a rule to the plan using the "MatchSpritePosition" function to make a sprite be in the same location as another sprite. It is only available for plans because a bag sprite (for example) can't know which sprite is the player sprite for the current map. Only a plan knows which sprites are on the current map. (In the future I may be able to do something like "SetTargetSprite" to allow sprite rules to also refer to specific sprites, though.)
Does this help?
-
it works, it works! YEAH!!
this is really cool....
(often i forgot to look what other methods are available for plans. i sought hardly for it at the sprite definitions)
i look forward to a "setTargetSprite" because it is coincidence that the parent sprite is the player in my game.
-
and is there a method for UNmatching the position? like giving control of position back to the sprite itself?
i need to let go of the bag.
edit: oops. yet it works.
here is the plan rule: if Counter == 0, matchSpritePosition.
(when the player hits Button1, the Counter increments and stops. that would mean "let go of the sprite", since it is a "else" condition. i thought that would work, but it only works if i define a Button1. when i say "if key rightShift is pressed" instead of Button1, the bag will move a little bit and then stop. curious thing, isnt it?)
-
I don't quite understand what you did or if it worked. Do you still have a problem with dropping the bag? Have you tried to use LogDebugValue to work it out?
-
it is working now.
i use the log debug methods quite often to figure things out.
forget the blabla above. ;D