Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / How to detect click on sprites (plus some other stuff)

Author
Message
Pyromaniac
21
Years of Service
User Offline
Joined: 8th Jan 2003
Location: United Kingdom
Posted: 13th Feb 2003 19:20
sooo...I've got my tile based RPG map editor working, but i need to know a few things before i can expand it

1) how do i detect when the user clicks on a sprite? (when the use right clicks on an instance of the sprite, it will change image)

2) how do i make text appear above sprites? (ie, on in front of and not behind)

3) how would i stop the user placing lots of sprites on top of each other?

I might not be able to reply to any follow up posts, because i'm moving house tomorrow

below is my code

(DBpro, BTW )

You could take over the world with a programming language like this...
...not that I would attempt to...yes, that'll do...
John H
Retired Moderator
22
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 13th Feb 2003 22:57
OK, here we go

1) Find the coordinates of the sprite, then find the dimensions of the sprite. Plug these into an equation you can have a mouseover snippet. Check if your mouse is from the start of your sprite (like sprites#) to the end of your sprite (sprite# + spriteL [sprite length]) then, if its over it, have a value equal one, then you can click it.

2) Id suggest making the text a sprite, using the textwidth to make the text a bmp, then get image, then make that a sprite

3) When the user 'drops' a sprite, store its individual location in an array, and whenever the user 'drops' a sprite after that, read the data in that array, and make sure where the user is droping the sprite is not near (using + or -) any of the sprites locations stored in the array

I hope this helps you

RPGamer

Current - RPG: Eternal Destiny : Help Wanted!
http://www.halbrosproductions.netfirms.com
Dont ask those questions! Read the help files lazy!

Login to post a reply

Server time is: 2024-11-24 02:57:30
Your offset time is: 2024-11-24 02:57:30