Joao Rui wrote:
> 
> Hi to all on the list,
> 
> I was wondering if anyone could give me a hand with
> this....?
> I am trying to make an object squeeze fit into an
> other.
> Here�s an example of what I would like to have happen:
> 
> Imagine having an empty container (box) as one sprite
> and another sprite that could be a car for example.
> The car would be longer that the box so it wouldn�t
> fit but if I pushed it through the box�s opening it
> would
> stretch sideways and deforme the bitmap.
> 
> Anyone know of a way or of lingo that could aid me.

Hmm...

Here's a start, feel free to expand on it

assuming the car gets pushed in from the left
<untested code>

on someTriggeringEvent
  boxLeft   = sprite(box).rect[1]
  boxTop    = sprite(box).rect[2]
  boxRight  = sprite(box).rect[3]
  boxBottom = sprite(box).rect[4]
  padding = 4 -- so the car doesn't actually touch the box

  newBoxRight = max(boxRight, sprite(car).rect[3] + padding

  sprite(box).rect = rect(boxLeft, boxTop, newBoxRight, boxBottom)
end

</untested code>

You would probably test to see if the car was all the way in the box and
stop its rightward motion when it is.
-- 
Carl West    [EMAIL PROTECTED]
617.262.8830 x246    

I have no superfluous leisure; my stay must be
stolen out of other affairs; but I will attend you awhile.

           - Isabella, Measure for Measure, Act 3 Scene 1

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to