Making Hide from other object

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
roypro
Posts: 4
Joined: Wed Jun 03, 2020 12:04 pm

Making Hide from other object

Post by roypro » Wed Jun 03, 2020 12:16 pm

Hello.
I was making a game and there are many problems that I don't know how to solve:
How do I code somthing like this in the main object( img "myimg"):

Code: Select all

on ???
	hide me
end ???
But in the card:

Code: Select all

on openCard
	hide img "myimg"
end openCard

Thanks for solving this. :D
Roy.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10116
Joined: Fri Feb 19, 2010 10:17 am

Re: Making Hide from other object

Post by richmond62 » Wed Jun 03, 2020 12:28 pm

Well, I have never liked 'hide' and 'show', preferring this sort of thing:

Code: Select all

on mouseUp
       set the vis of img "Spotty_Face" to false
end mouseUp

roypro
Posts: 4
Joined: Wed Jun 03, 2020 12:04 pm

Re: Making Hide from other object

Post by roypro » Wed Jun 03, 2020 12:31 pm

But it work if I will make this command on the card?

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10116
Joined: Fri Feb 19, 2010 10:17 am

Re: Making Hide from other object

Post by richmond62 » Wed Jun 03, 2020 12:43 pm

Yes:
-
Screenshot 2020-06-03 at 14.41.40.png
-
Have fun. 8)

Check out the cardScript and the script of button "SWITCH".
Attachments
Hell.livecode.zip
Here's the stack.
(22.37 KiB) Downloaded 194 times

roypro
Posts: 4
Joined: Wed Jun 03, 2020 12:04 pm

Re: Making Hide from other object

Post by roypro » Wed Jun 03, 2020 12:54 pm

Thanks :D
And my last question it's:
How do I call an operation like this:

Code: Select all

on AutoMover
   put 209 into tX
   repeat until _gExit? or _gLoose? = 1
      NeedSubtractHeart
      subtract 1 from tX
      set the location of group "EasyMap" to tX , 209 
      wait 1 sec
   end repeat
   
end AutoMover
But I will call this operation from the card.

Code: Select all

on openCard
	AutoMover
end openCard
I was thinking to solve this by using the send command for the call of this operation from the card.

Thanks for helping me :D
Roy

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

Re: Making Hide from other object

Post by Klaus » Wed Jun 03, 2020 1:01 pm

Ho Roy,

welcome to the forum!

If you want to execute AutoMove when the card opens, this is the correct way:

Code: Select all

on openCard
   AutoMover
end openCard
You "AutoMover" handler has to be in the card or stack script* for this to work.
*At least somewehre in the message history.


Best

Klaus

roypro
Posts: 4
Joined: Wed Jun 03, 2020 12:04 pm

Re: Making Hide from other object

Post by roypro » Wed Jun 03, 2020 1:11 pm

Thanks!!!!! :D

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10341
Joined: Wed May 06, 2009 2:28 pm

Re: Making Hide from other object

Post by dunbarx » Wed Jun 03, 2020 1:36 pm

Hi.

Just for learning,

Code: Select all

on ???
	hide me
end ???
would be hard to use. If you placed that in the image, perhaps in a "mouseUp" handler, how would you ever be able to see the image again? And if you placed it anywhere else, the reference to "me" would not make any sense.

But if you put something like this somewhere you can always use it:

Code: Select all

set the visible of  img "myimg" to not the visible of img "myimg"
then the image would toggle between hiding and showing.

Craig

Post Reply