0 Favourites

Mouseclick within Parameters (Solved)

  • 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.

    <img src="http://img267.imageshack.us/img267/5017/taskbarproblem.png" border="0" />

  • Ah Also, instead of "SCROLLING" the ship i want it to be in the center of those Mouse Parameters. Or the "Playable area"

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

    No that is just a ugly ui where the Buttons will be placed upon <img src="smileys/smiley36.gif" border="0" align="middle" />

    But it does not matter i guess

  • 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.

    Thx   <img src="smileys/smiley2.gif" border="0" align="middle" />

    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 <img src="smileys/smiley1.gif" border="0" align="middle" /> )

  • 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:

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

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

  • Posting your capx would help us help you.

    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 <img src="smileys/smiley1.gif" border="0" align="middle">

  • 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.

  • 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 <img src="smileys/smiley17.gif" border="0" align="middle" />

    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?

  • Ha I forgot, remove the creation action it is not needed, use only one sprite5 instance.

    It takes less ressources to make a sprite visible/invisible rather than create/destroy.

    Scrolling to the player will have the same effect as it was before (before I removed the scroll to behavior).

    What you want is rather to use lerp for a few frames to make the scrolling move progressively instead of "gap".

    Like in this quick example

  • You make mistakes !?

    Thanks for the example ^^ i am not 100 % sure which one i am going to use.. Still gotta decide what looks better.

    But now i have options :)


    Oh yeah and thx for telling me that with Delete using more power.



  • I did some configurations to the UI stuff :)

    Check it out.

    Press the Grey Triangle to Collapse The UI.


    I have not configured it to different screen sizes

  • Btw !

    Am i correct in saying that the Game is Calling every function that is True, every every time it checks the event sheet ?

  • Extract from how events work:

    vents run top to bottom

    The order of events is important. Every event is checked once per tick (about 60 times a second on most computers), and they are run from top to bottom in the event sheet. The screen is drawn once every event has been run, then the process starts again.

    So yes, any events which conditions return true will be executed each tick.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Depth sorting - almost solved
62 5,165
lucid's avatar
15 997
jimutt's avatar
Unread hot topic
0 Favourites
How do I fix this (Solved)
47 1,948
tomi71's avatar