Page 1 of 1

Making Hide from other object

Posted: Wed Jun 03, 2020 12:16 pm
by roypro
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.

Re: Making Hide from other object

Posted: Wed Jun 03, 2020 12:28 pm
by richmond62
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

Re: Making Hide from other object

Posted: Wed Jun 03, 2020 12:31 pm
by roypro
But it work if I will make this command on the card?

Re: Making Hide from other object

Posted: Wed Jun 03, 2020 12:43 pm
by richmond62
Yes:
-
Screenshot 2020-06-03 at 14.41.40.png
-
Have fun. 8)

Check out the cardScript and the script of button "SWITCH".

Re: Making Hide from other object

Posted: Wed Jun 03, 2020 12:54 pm
by roypro
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

Re: Making Hide from other object

Posted: Wed Jun 03, 2020 1:01 pm
by Klaus
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

Re: Making Hide from other object

Posted: Wed Jun 03, 2020 1:11 pm
by roypro
Thanks!!!!! :D

Re: Making Hide from other object

Posted: Wed Jun 03, 2020 1:36 pm
by dunbarx
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