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 / Collision between mouse and sprite

Author
Message
Fneep
19
Years of Service
User Offline
Joined: 3rd Sep 2005
Location: In my house
Posted: 19th Jan 2006 08:10
Is it possible to detect collision between the cursor and a sprite? If so, how?

SirFire
19
Years of Service
User Offline
Joined: 4th Apr 2005
Location: North America
Posted: 19th Jan 2006 08:28
create a dummy sprite that follows the mouse cursor around and hides behind it?

Shadowed Lightning
19
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 19th Jan 2006 08:40
I've never used sprites before in my life, but I will try to help.
Is it possible to make the mouse into a sprite? Or at least make a sprite into a mouse. When I say that I mean you could say:

and then use:

Well thats all I've got, let me know if thats what you needed and if it even works.

AMD Athlon 64 3200 - GeForce 6800 GT - 320GB Hard Drive
1024MB RAM
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Jan 2006 09:50 Edited at: 19th Jan 2006 09:56
@ Shadowed Lightning

"set sprite" can't be used in that way. SirFire is right about the mouse. You can make the mouse be anything you want... but you need the actual sprite that detects the collision to be another sprite entirely. If you checked collsion on a mouse sprite the collision is detected on the entire mouse. You want the collision check on the tip of the mouse only.

In this code snip the actual collision check is the small white dot at the tip of the mouse sprite... which normally would be hidden (remove the rem statement from "hide sprite 101"). If you want to see what happens if the entire mouse is detected for collision change the 101 to 100 in "if sprite collision(101,t)".




Shadowed Lightning
19
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 19th Jan 2006 09:56
I am well aware of that, when I said:

Quote: "Is it possible to make the mouse into a sprite? Or at least make a sprite into a mouse."


What I meant was that you could make a sprite act as a mouse by locking its position to the mouse's position and then checking for collision with it, which is why I said: "Or at least make a sprite into a mouse."
Though I am not very good at expressing my ideas so maybe what I said was misleading...

AMD Athlon 64 3200 - GeForce 6800 GT - 320GB Hard Drive
1024MB RAM
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Jan 2006 10:04
Quote: "Though I am not very good at expressing my ideas so maybe what I said was misleading... "


It's ok... Black Ethereal can use that code snip to learn how to do mouse collision. Really that snip was for both of you because he asked and your message was just a bit misleading.


Shadowed Lightning
19
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 19th Jan 2006 10:21 Edited at: 19th Jan 2006 10:23
Well thankyou, as mentioned, that was the first sripte command I have ever written in my life, so it wasn't a guranteed best seller
I just spent 2 hours making an awesome and actually somewhat fun little run around game/thing. Once again, the character was none other than the cube! But I used a terrain code someone gave me to load terrains from a heightmap and I added a bunch of camera collision (a BUNCH) and movement and I added collision and gravity. Then I lost it, and now I can't remember how I did any of it...

AMD Athlon 64 3200 - GeForce 6800 GT - 320GB Hard Drive
1024MB RAM
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Jan 2006 10:26
Sorry... I didn't mean that as an insult.


Shadowed Lightning
19
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 19th Jan 2006 10:42
Oh, I didn't take it as one, once again, I'm a bit misleading
(I am slowly reconstructing my code, but its not going well)

AMD Athlon 64 3200 - GeForce 6800 GT - 320GB Hard Drive
1024MB RAM
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Jan 2006 10:47
Ouch.


Shadowed Lightning
19
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 19th Jan 2006 10:56 Edited at: 19th Jan 2006 11:13
Here it is so far, the actual heightmap code came from I think xIcedxEarthx


there are alot of missing remarks and its not even working right anymore but at least its not completely gone, really crappy terrain too:

[EDIT]
Ok, so I just got it back to how I think it was, but I still think theres something missing.


AMD Athlon 64 3200 - GeForce 6800 GT - 320GB Hard Drive
1024MB RAM

Attachments

Login to view attachments
Shadowed Lightning
19
Years of Service
User Offline
Joined: 10th Nov 2004
Location:
Posted: 19th Jan 2006 11:16 Edited at: 19th Jan 2006 11:16
Sorry here is the heightmap and water and grass:

[AND SORRY FOR TAKING OVER THIS THREAD! ]

AMD Athlon 64 3200 - GeForce 6800 GT - 320GB Hard Drive
1024MB RAM

Attachments

Login to view attachments
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 19th Jan 2006 21:39
Looks good.


Login to post a reply

Server time is: 2024-09-24 15:35:52
Your offset time is: 2024-09-24 15:35:52