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 / Mouse coordinates.

Author
Message
Regnuar
15
Years of Service
User Offline
Joined: 25th Dec 2008
Location:
Posted: 4th Jan 2009 21:19
I have a small problem with mouse coordinates. so can someone give me a helping hand and tell exactly what's wrong in my code, i know this needs lots of more code, but i'm not quite sure what.

code goes like this:

my = mousey()
mx = mousex()

blablablabla..

if my > object position y(1) and mx > object position x(1)
scale object 1,100,100,100
yrotate object 1, object angle y (1)-0.9
set cursor 295,20
print "New file"
else
scale object 1,80,80,80
endif

by the way, as i am a noob around here, how i can make "code snippet"?
May0naise
16
Years of Service
User Offline
Joined: 16th Nov 2008
Location: Lost in Time
Posted: 4th Jan 2009 21:39
Well im pretty much a noob too, but i can already see your positioning an object you never made.

For doing the code snipits, there is a button in the top right of the box where you post that says "code". You click it, copy an past your code after it, then click it again.



And whats blablablabla..?

Be patient....everything takes time.
Regnuar
15
Years of Service
User Offline
Joined: 25th Dec 2008
Location:
Posted: 4th Jan 2009 22:23
oh yeah, i have done the object, that was just one part of the code and i thought it would be enough =) anyhow, here is the full code you need to see, i allready figer something out but it's not still working.

Regnuar
15
Years of Service
User Offline
Joined: 25th Dec 2008
Location:
Posted: 4th Jan 2009 22:29
Oh! i forgot the media, sorry. they are now attached.

Attachments

Login to view attachments
Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 5th Jan 2009 00:53
I'm not sure what you are trying to do, but I went through your code and made some comments:



I hope it helps. Maybe you can tell us more about what you are trying to accomplish.


Whatever...
Phantom 2590
17
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Earth...
Posted: 5th Jan 2009 02:46 Edited at: 5th Jan 2009 03:13
from what i can see just by glancing at it he's trying create a menu.
I'll take a look at it soon as i get a chance to download your media

@Dabbler
I don't see why you commented out his load object commends. I mean the code is to help him out so he's gona need that in his code and he might not know well enough to uncomment them if you can understand what I'm saying. He did say he was rather new.

Edit:
Put this code inside the do loop




Like so
and may I suggest positioning and pointing the camera correctly or else all your going to see is a black screen most likely.
The code for that is


Alternatively you can create your own camera with Make Camera and then the camera number. 0 is just the default camera.

The code for when the mouse is on top of the new file object still isn't working right. I'll see what I can do.

I was therefore I can be.
Dabbler
17
Years of Service
User Offline
Joined: 3rd Mar 2007
Location: Minnesota
Posted: 5th Jan 2009 05:39
I think you may be looking for something like the pick command.

Try this:



I hope it works for you.


Whatever...
Regnuar
15
Years of Service
User Offline
Joined: 25th Dec 2008
Location:
Posted: 5th Jan 2009 11:21
Great thanks to you dabbler! if pick object(mx,my,1,1)=1 is the code i was looking for. And sorry i forgot to tell what i was trying to do =D i try to tell it next time when i ask some help.

and ofc thanks to you all who even bothered help me
Phantom 2590
17
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Earth...
Posted: 5th Jan 2009 21:13
Glad we or Dabble rather could help you out.

I was therefore I can be.
Tom0001
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location:
Posted: 7th Jan 2009 11:10
@Regnuar,

Couldn't you just use 'IF mousex() > object positionblabla' instead of assigning the mousex() value to a variable and checking if the variable is greater than it?

=PRoF=
21
Years of Service
User Offline
Joined: 17th Mar 2003
Location: Milton Keynes, UK
Posted: 7th Jan 2009 20:16
Its faster to refer to a variable, than to make repeated calls to a function.

This way mousex() needs only be called once a loop.

I do this a lot with things like screen width(), which I may call dozens of times drawing a hud or something.

Some commands like screen fps() can only be called once a loop, or else it returns an incorrect value, so assigning it to a variable is a good way of using the data more than once per loop.

Without Music or Love the world would be a very empty place... Thank god I still have music.. --'-<@

Login to post a reply

Server time is: 2024-11-24 14:39:33
Your offset time is: 2024-11-24 14:39:33