Make an object visible when click on

Chat about anything not covered in these forums, but keep it civil!

Post » Sat Aug 06, 2011 2:24 am

Hello,

I have two questions:

1) I would like to have an object invisible at the start of a game. I want it to then become visble once the mouse clicks on it. I can't for the life of me get this to work. can anyone help?

2) Also, is it possible to set the game up to automatically forward to a URL once the game is over? if so, is it possible to have it forward to different url depending if the game was a successful win or a total loss?

Thanks in advance for your help

Dave
B
6
S
1
G
1
Posts: 52
Reputation: 829

Post » Sat Aug 06, 2011 2:51 am

Sprites have a visibility setting in Properties (a tick box)....'invisible on start' ...tick it ! !

To make it reappear you will need to create an event to turn it's visibility back to 'on'.

Example:

+ MouseKeyboard: On Left Clicked on cover
-> cover: Make Visible
.
------------------------------------------------

Can't answer the URL question.
B
19
S
6
G
7
Posts: 1,205
Reputation: 7,298

Post » Sat Aug 06, 2011 3:02 am

With construct classic

Use the expression System.Run Script

[code]"import webbrowser
webbrowser.open('http://python.org')"[/code]
(It is python code)

On Construct 2 you can use the browser object and its action "Go to url".


Also, those type of question would be better if asked in the Help & Support using Construct Classic section (if they are targeted at CC) or Construct2 General section if they are targeted at C2.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Sat Aug 06, 2011 3:13 am

Pretty sure you can't click invisible objects, try opacity instead.
Image Image
B
161
S
48
G
90
Posts: 7,354
Reputation: 66,763

Post » Sat Aug 06, 2011 3:30 am

[QUOTE=newt] Pretty sure you can't click invisible objects, try opacity instead.[/QUOTE]

------------------------------------------------------

You can click on an invisible object to make it visible again (if you can find it !)
Might be a 'Find the invisible object with click' game?

B
19
S
6
G
7
Posts: 1,205
Reputation: 7,298

Post » Sat Aug 06, 2011 5:22 am

You don't need python scripting for the url, simply use the file object, execute file, then put the url in quotes.
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sat Aug 06, 2011 7:11 am

[QUOTE=chrisbrobs] [QUOTE=newt] Pretty sure you can't click invisible objects, try opacity instead.[/QUOTE]

------------------------------------------------------

You can click on an invisible object to make it visible again (if you can find it !)
Might be a 'Find the invisible object with click' game?

[/QUOTE]

Strange, I could swear invisible objects weren't draw, and couldn't do collision detection.
Image Image
B
161
S
48
G
90
Posts: 7,354
Reputation: 66,763

Post » Sat Aug 06, 2011 7:28 am

Hmmm.. I thought it should be that simple too. But for some reason that didn't work for me. Here's what I did, maybe I am missing an important step.
1) I created a sprite object and set the "initial visibility" to invisible
2) I added a mouse object
3) I went to the event list and set Mouse --> On Left Button Clicked --> Sprite Set Visible

when I go to run the game, I click all over the screen and nothing happens

am I missing something?

thanks
B
6
S
1
G
1
Posts: 52
Reputation: 829

Post » Sat Aug 06, 2011 7:31 am

Newt,

Opacity worked thanks!!

Thanks to everyone who tried to help, I really appreciate it!
B
6
S
1
G
1
Posts: 52
Reputation: 829

Post » Sat Aug 06, 2011 9:16 am

daveryaaziem / Newt

I know you resolved it, but here's the cap i tested using invisible 'off'
option.

Invisible

B
19
S
6
G
7
Posts: 1,205
Reputation: 7,298

Next

Return to Open Topic

Who is online

Users browsing this forum: Allexsander and 2 guests