Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 05:41
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AbrahamR, AndrewAMD), 1,278 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 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 | chip programmers | 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