Transparent Stack

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Jul 15, 2009 11:36 am

Hi Bidge,

very nice :)
BUT: Your images and IDs are not in sync, that's why you see these strange "flickering" :-D
Image "s0013.png" has the ID 1004!

OK, here is what you should do, since hiding/showing images are not necessary and may cause
flickering and unneccessary delays!

1. Hide all your PNG imgages!
2. Create an empty image "display" wiht the same dimension as your PNGs = 320*240, location 160,120
3. Set the layer of your button to top!
4. then put this into your button:

Code: Select all

on mouseUp
   put the ID of img "display" into tID
   repeat 5
      repeat for each item i in "0001,0002,0003,0004,0005,0006,0007,0008,0009,0010,0011,0012,0013"

         ### This is the trick! Only have ONE image so hiding/showing is not neccessary!
         put img ("s" & i & ".png") into img "display"
         set the windowshape of this stack to tID
         wait 100 millisecs
      end repeat   
   end repeat
   put empty into img "display"
   set the windowShape of this stack to 0
end mouseUp
And be a happy camper just like you cartoon guy :)

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Jul 15, 2009 11:47 am

To have even more fun do this:

1. Put your stack at the right side of your monitor
2. Add this line right after "on mouseup":

Code: Select all

on mouseup
   move this stack rel -600,0 in 6.5 secs without waiting
   ...
You may want to experiment wiht the duration :)

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Wed Jul 15, 2009 11:48 am

Hello Klaus......I see what you mean about using the one image now...In your code should the "display" be set to? I tried setting it to an image but I just get a grey ghosted aea.

Cheers
Bidge

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Jul 15, 2009 11:59 am

Hi Bidge,

nothing to set to!
You can simply "put" one image into another image.

And my scripts are always usable right out of the box!!!, as long as everything is set up correctly, in this case you need just an empty image named "display".


Best

Klaus

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Wed Jul 15, 2009 12:05 pm

Hi Klaus....I get a compile error.....no such object "display"


EDIT :
button "Button": execution error at line 4 (Chunk: no such object) near "display", char 12


Bidge

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Jul 15, 2009 12:08 pm

Sigh...

What exactly do you not understand at point 2. in my list of my post from Wed Jul 15, 2009 10:36 am???

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Wed Jul 15, 2009 12:10 pm

I replaced the "display" with an image....image s001.png but I just get a grey ghost?

Bidge

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Jul 15, 2009 12:14 pm

GEEEEEZ! Please read my posts!

OK, maybe this is EVEN MORE understandable???
...
2. Create a NEW (and thus empty) image object AND NAME IT "display" ...
...

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Wed Jul 15, 2009 12:25 pm

Okay....thanks I get it. Sorry. I had no idea I had to create a completely empty .png file to see what was going on.
but it works :) ....and the horizontal movement is a fantastic effect!!!!
Phew!!!!

Many thanks for your patience Klaus.

Cheers
Bidge

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Jul 15, 2009 12:31 pm

Hi Bidge,
bidgeeman wrote:Okay....thanks I get it. Sorry. I had no idea I had to create a completely empty .png file to see what was going on.
Nope!
You just needed to drag an empty image from the Rev tool palette to your stack, name it "display" and set its dimensions and loc as I told you.
bidgeeman wrote:Many thanks for your patience Klaus.
Cheers
Bidge
Kudos goes to my mom (RIP) for educating me so well ;)


Best

Klaus

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Wed Jul 15, 2009 12:35 pm

OMG!!!!! I did'nt see those instructions at all!!!!! Sorry sorry sorry Klaus. Noi wonder you were upset. I actually missed them altogether. I just noticed them then

Oh dear :oops:

Bidge

Klaus
Posts: 14198
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Post by Klaus » Wed Jul 15, 2009 12:40 pm

GEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEZZZZZZZZZ! :D

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Post by SparkOut » Wed Jul 15, 2009 4:19 pm

Or put something like this in the stack script, for fun:

Code: Select all

on arrowKey theArrow
   put the loc of this stack into theLoc
   switch theArrow
      case "up"
         subtract 4 from item 2 of theLoc
         break
      case "down"
         add 4 to item 2 of theLoc
         break
      case "left"
         subtract 4 from item 1 of theLoc
         break
      case "right"
         add 4 to item 1 of theLoc
         break
   end switch
   set the loc of this stack to theLoc
end arrowKey
and maybe edit the button script to make a long or infinite loop that you can escape from by holding down the command/control key

Code: Select all

on mouseUp 
   put the ID of img "display" into tID 
   repeat forever
      repeat for each item i in "0001,0002,0003,0004,0005,0006,0007,0008,0009,0010,0011,0012,0013" 
         
         ### This is the trick! Only have ONE image so hiding/showing is not neccessary! 
         put img ("s" & i & ".png") into img "display" 
         set the windowshape of this stack to tID 
         put the loc of this stack into theLoc
         if the controlKey is down or the commandKey is down then 
            put empty into img "display"
            set the windowShape of this stack to 0 
            exit to top
         end if
         wait 100 millisecs with messages
      end repeat    
   end repeat 
end mouseUp
Now you can make your man run around the screen by pressing the arrow keys. Of course you should have a different set of graphics that change according to the direction he's running...

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Thu Jul 16, 2009 1:24 am

Oh man!!!! That's excellent Spark! I'll get to work and create some more angles :)

Cheers
Bidge

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Post by bidgeeman » Thu Jul 16, 2009 5:06 am

Here are some more sprites to play with. Running left, Running right, going up and down. The sprites for up and down should look quite funny....he just stands there with loose limbs as if he is being levitated.

EDIT: Just added: front standing still shot.

http://www.errolgray.com.au/Bidgesprites.zip

:lol:
Cheers
Bidge

Post Reply