Mouseclick within Parameters (Solved)

Get help using Construct 2

Post » Sat Feb 11, 2012 2:02 pm

I am working on the HUD of my Game right now and the problem i have is that at the moment the Spaceship will just move towards the last Mouseclick.

Now that i am adding HUD with "Spells" etc. That would overlap with the Mouseclick i want the Movement Mouseclicks only to happen On a certain Screen Area.



I think Event Mouseclick and Compare Values is the way to go. But i am not shure how.
Schoening2012-02-12 16:13:27
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sat Feb 11, 2012 2:32 pm

Ah Also, instead of "SCROLLING" the ship i want it to be in the center of those Mouse Parameters. Or the "Playable area"
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sat Feb 11, 2012 2:37 pm

Try adding an inverted "mouse is over object" condition at the start of your movement control events. That way the movement control events won't trigger unless you're on viable play area.
B
58
S
20
G
7
Posts: 305
Reputation: 8,804

Post » Sat Feb 11, 2012 2:39 pm

I guess the "Spells" are the big gray blocks.
You know then that when mouse cursor is not over a gray spell block, than it is in "playable" area.

Posting your capx would help us help you.
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: 7,000
Reputation: 57,795

Post » Sat Feb 11, 2012 2:47 pm

[QUOTE=Kyatric] I guess the "Spells" are the big gray blocks.
You know then that when mouse cursor is not over a gray spell block, than it is in "playable" area.
[/QUOTE]

No that is just a ugly ui where the Buttons will be placed upon

But it does not matter i guess
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sat Feb 11, 2012 2:51 pm

[QUOTE=TL22] Try adding an inverted "mouse is over object" condition at the start of your movement control events. That way the movement control events won't trigger unless you're on viable play area.[/QUOTE]

Thx   

What about when i place a Button on top of the UI ?

Is the Mouseclick NOT on UI still apply ? or do i need a Comparison for every Button on top of the UI ?


If so, i suppose i can just create a Family for the Buttons and UI and make MOUSECLICK NOT on FAMILY UI

.. right?


(Yes i bought it, so i have familie feature )
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sat Feb 11, 2012 3:20 pm

Posting your capx would help us help you.

TL22 and my solutions are the same.
If your mouse cursor is not over your gui element:

[code]Mouse: Cursor is over GrayStuff =/ invert (right click on the event)
Do stuff in the playable area[/code]

[code]Mouse: Cursor is over GrayStuff
Do stuff in the GUI area[/code]

Anyway, your GUI elements should react to the "Mouse: on object clicked" condition, not just "any click".

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: 7,000
Reputation: 57,795

Post » Sat Feb 11, 2012 4:33 pm

[QUOTE=Kyatric] Posting your capx would help us help you.


[/QUOTE]

Here you go !

There is not much added since i am still reading on what to do :)


MY concern is that if: Mouseclick object(ui) =/ then Move Ship etc..
    
What if the object(ui) is behind a object(button) ?
Woulnt that mean that Mouseclick object(ui) =/ is true? Even though it is still not in the playable area?


And can't i avoid that problem by Mouseclick object (Family Ui + buttons + etc.) ?


I like brainstorming.. i could just trial and error it Schoening2012-02-11 16:34:56
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Sat Feb 11, 2012 5:03 pm

You shoudln't use several every tick and on start of layout, gather your actions.

Also as you can notice, I've removed most of your every tick events, they are useless.
As mentionned in how events work, the event sheet is read top to bottom, and every event which condition(s) will return true will get executed.

Also, I guess you should have a look at the best practices and the performance tips.

There's something wrong with your textures in your tiledbackground, it's pretty useless to have a big 1000X1000 texture in a tiled background, as well as creating numerous instances of the same tiledbackground.
The purpose of the tiled background is to repeat a small texture seamlessly to avoid having huge projects to download.

You're using it the opposite way.

Anyway fixed capx.Kyatric2012-02-11 17:04:22
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: 7,000
Reputation: 57,795

Post » Sat Feb 11, 2012 5:30 pm

The Sprites are not the ones i am going to use, i know some are to big, but that i don't care since it is working on my PC.

However i can see how that might upset a programmer who is more neat and tidy that i :)


Thx for the Clean up and the Links, i will look into them.


However.. 1 thing in your fixed .capx that is not working, and another one that just seems like a very bad idea:

The thing that is not working is the Scroll to Mouseclick is just giving HUGE jumps. Thus it looks sh*tty

So i think i have to use some kind of scroll to Player.

The other thing that bugged me is how you changed the "Target" Sprite.

You create "Target" Sprite at Mouse.X/Mouse.Y
set Visible. and after 0.3 you set to Invisible.


Perhaps i am wrong. But invisible does not mean Destroy.

So what happens is that there will be created tons and tons Invisible Sprites..

Correct me if i am wrong and Invisible is destroying the Sprite :). ALSO   why was:

create sprite at x,y wait 0.3 sec   destroy sprite    

not good enough?


Schoening2012-02-11 17:32:23
B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests