Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/25/26 19:13
ZorroGPT
by TipmyPip. 04/25/26 16:09
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (AndrewAMD, Grant, valino), 3,361 guests, and 13 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Panels and the trace instruction, please help #10703
10/17/02 06:24
10/17/02 06:24
Joined: Sep 2002
Posts: 307
United Kingdom
dragon100 Offline OP
Senior Member
dragon100  Offline OP
Senior Member

Joined: Sep 2002
Posts: 307
United Kingdom
Hi

I’m creating a game where an entity can be moved by clicking on it and clicking on a given area of the screen . The problem is that I have added a panel to the level and when I click on the area where this panel is situated (after clicking on the entity) the entity moves.

I use trace instruction to find where I have clicked in order to move the entity

Is there a way to prevent this from happening i.e. to prevent the trace instruction from ‘hitting’ the level floor past the panel, and hence setting a destination where the entity moves.

Or does anybody have any suggestions of what I can do to

If my question is not clear plz let me know

Thanks

Dragon 100

Re: Panels and the trace instruction, please help #10704
10/18/02 05:07
10/18/02 05:07
Joined: Jun 2002
Posts: 248
NZ
mudhole Offline
Member
mudhole  Offline
Member

Joined: Jun 2002
Posts: 248
NZ
Before you do the trace, why not check if the user has clicked inside the area of the screen occupied by the panel. If he has clicked inside the panel, don't do the trace.

eg.
code:
if((mouse_pos.x < yourPanel.x) ||
(mouse_pos.x > (yourPanel.x + yourPanel.width)) ||
(mouse_pos.y < yourPanel.y) ||
(mouse_pos.y > (yourPanel.y + yourPanel.height)) )
{
// the user has clicked outside the panel, so do the trace
trace(.......);
}

Now I know .width and .height are not actually members of yourPanel, but you should know the values and can just put them in.

Re: Panels and the trace instruction, please help #10705
10/18/02 18:30
10/18/02 18:30
Joined: Sep 2002
Posts: 307
United Kingdom
dragon100 Offline OP
Senior Member
dragon100  Offline OP
Senior Member

Joined: Sep 2002
Posts: 307
United Kingdom
thanks a lot mudhole

that fixed the problem! [Big Grin]


Moderated by  HeelX, Spirit 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1