newbie questions/

Klaus Major klaus at major-k.de
Sun Feb 19 05:12:04 EST 2006


Hello Benjamin,

> hi!

please let me welcome you to the list first :-)
> I downloaded Revolution to test some
> things I want to accomplish for a game.
>
> I am having trouble trying to find how to
> apply a command to make a picture (or quicktime movie) Draggable.
>
> Example of what I want to accomplish:
>
> I have a 3d Barrel picture:
> I want to be able to:
>
> -Move the barrel freely on the screen (or maybe to an specific part)
> -How do I play a sound while I am dragging the barrel?
> then stop (or pause) the sound when I stop dragging?


Hint: This is only ONE possible solution! ;-)

1. Create a player object to play your "dragging" sound.
I will call it "dragsound" in my example

2. Put this into the script of you image (to be dragged):

###############################
on mousedown
    set the looping of player "dragsound" to true
   ## this is optional, just in case you only have a short sound
   ## and want to play it in a loop

   set the currenttime of player "dragsound" to 0
   ## "rewind" the sound, in case it has been started before

   start player "dragsound"
   ## finally "play" that sound

   grab me
   ## this will make the image draggable finally :-)
end mousedown

on mouseup
    stop player "dragsound"
end mouseup
##############################

That was it :-)

> I want to apply the same commands to a quicktime
> movie and be able to go to an specific animation
> track section (ej. Dragging makes sound, double clicking

Just add a "on mousedoubleup" handler to your object.

> plays an "open barrel top" animation.

You can do the same as above with a quicktime movie, but
that may cause lots of flickering on the screen unless you set
"the alwaysbuffer" of that movei/player to true.

BUT in that case the playback of the movie may be a bit jerky.
Sorry to say, but that may be very unsatisfying...

> At the same time I want to send a Message to another
> object. Ej. On double clicking the barrel send "barrelOpened"
> msg and trigger another action on any object, sound etc.

That is almost the correct syntax :-)

Create a custom handler "on barrelOpened" in the script of your
"target" object:

e.G. Button "xyz"

on barrelOpened
  ## do this and do that
  ## and whatever you want
end barrelOpened

And then you can simply "send" this message from any other object to
the object that you want to react upon the message:

on mousedoubleup
   send "barrelOpened" to btn "xyz"
   ## or whatever object has the script above
end mousedoubleup

Imortatnt hint:
QUOTES are absolutely necessary around the name of the message to be  
sent, see above!

> Also, Revolution recognises alpha channel in a quicktime movie? (3d  
> model)

No, unfortunately not.

> Thanks!

Hope that helps.

> Benjamin

Regards from germany

Klaus Major
klaus at major-k.de
http://www.major-k.de




More information about the use-livecode mailing list