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.

DarkBASIC Professional Discussion / Locking an object to the mouse cursor...

Author
Message
Paronamixxe
AGK Bronze Backer
14
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 18th Jan 2013 22:31 Edited at: 19th Jan 2013 21:42
______SOLVED______

Hey! My idea is that I would like to have an object (a plain to be exact) which plays a torch fire animation, so good so far. *DONE THIS PART* however when it comes to actually having this object following the mouse cursor, I've had a look on the forums and in the examples, although the code I find there for pick object ect is a little to weird for me to understand, if someone could please share some code which will allow me to place my object at the mouse cursor I would be so greatful!!

some possibly interesting info:
Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 19th Jan 2013 02:31 Edited at: 19th Jan 2013 02:37
Does this help you to get started?




Alternatively you can achieve same (if not better) effect in less code using Lock command (line31). But I failed to have it work on all resolutions, maybe you can play around with some values though. (snippet below should work on 640x480 and 1024x768, currently resolution in code is 1024x768).


The Taffer (+TaffED)
A thief inspired game along with the mission editor (DBPro). [on hiatus]
Paronamixxe
AGK Bronze Backer
14
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 19th Jan 2013 03:15
Thank you so much Lukas W!!! Worked like a charm! However, for some reason I can only move my torch cursor on the right hand side of the screen..??

Thanks anyway, and if you have any idea what might be causing this... please share
Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 19th Jan 2013 15:32 Edited at: 19th Jan 2013 15:33
No clue what might be causing this, it works fine on my laptop. (edit: although I use U75 of dbpro, maybe that is why)

Anyway, the third solution could be to simply use a sprite instead of an object - although a sprite in DBPro is basically a 3D plain. You should be able to have an animated sprite at the mouse cursor position easily; command "Draw To Front" will make sure sprites are behind any 2D text or images, just like a 3D object.

The Taffer (+TaffED)
A thief inspired game along with the mission editor (DBPro). [on hiatus]
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Jan 2013 20:26
[off topic]
The other day I was thinking about making a 2D platform game based on the Thief series, but making it in a simple NES-style. The game's name "Taffer" came to mind. But I just saw Lukas' signature.

"You're not going crazy. You're going sane in a crazy world!" ~Tick
Paronamixxe
AGK Bronze Backer
14
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 19th Jan 2013 20:44
@Lukas W I tried using sprites before, however there are no positioning commands! Im serious, you can only literaly point in a direction and use the
which makes it so impractical.

@Phaelax XD
Lukas W
22
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 19th Jan 2013 21:38
The positioning command for sprites is "Sprite"


Phaelax,
Go for it anyway, I have not looked at that Taffer source code in years ;D And truth be told, I had plans to change the name one day into something else, but never figured out what. However, it is a project I want to continue one day - just waiting for tgc to stop breaking the plugins I use with each patch they release ;D And also still waiting for mesh ragdolls in DarkPhysics.

The Taffer (+TaffED)
A thief inspired game along with the mission editor (DBPro). [on hiatus]
Paronamixxe
AGK Bronze Backer
14
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 19th Jan 2013 21:41
*EPIC FACEPALM*

Thanks Lukas W, I cannot believe that I didn't think of that :/

Login to post a reply

Server time is: 2026-07-07 18:21:57
Your offset time is: 2026-07-07 18:21:57