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.

Code Snippets / [DBC/DBP] Detect mousewheel event

Author
Message
Mistrel
Retired Moderator
19
Years of Service
User Offline
Joined: 9th Nov 2005
Location:
Posted: 22nd Jul 2007 07:24
This one is pretty self-explanitory.



http://3dfolio.com
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 22nd Jul 2007 10:11
Hi Mistrel, your declaring variables inside a function that will only be local to that functions scope, hence they are different in value to the variables with the same name outside of the function.




Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 22nd Jul 2007 16:56
MouseMoveZ() ?

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Jul 2007 19:16
You want to use a gosub for that. Even though gosubs are detached they are still seen as the main part of the program so all globals can be used. You don't actually need to declare variables in DB (but it's good practice), that's why your program still worked even though you were using a function.
The only other thing I've changed is the formatting. Using capital letters in variable names etc. makes them a lot easier to read, and I particularly like the section headers, I picked that up from TDK.

Good code



@ Z-Toast
Oh yes, you're right! There's no such command as MouseZ()!

I am king of the noobs!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 27th Aug 2007 22:14
Wait until you get older... section headers start looking like:

`---------------------------------------------- MOVECAR - Begin
`---------------------------------------------- MOVECAR
`---------------------------------------------- MOVECAR
`---------------------------------------------- MOVECAR
`---------------------------------------------- MOVECAR
...code here...
`---------------------------------------------- MOVECAR
`---------------------------------------------- MOVECAR
`---------------------------------------------- MOVECAR
`---------------------------------------------- MOVECAR
`---------------------------------------------- MOVECAR - End



Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 27th Aug 2007 22:57
Lol, in my experience that just makes code messy.

I never really go further than

` **************
` Move Car
` **************


But usually, for small things:

` Move car

and bigger things:

` Move car
` --------


Lawl.

"It's like floating a boat on a liquid that I don't know, but I'm quite happy to drink it if I'm thirsty enough" - Me being a good programmer but sucking at computers
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 28th Aug 2007 02:59
@Zotoaster

You Rebel!

I Meant to Email you - You have a physics lib? Can you email info?

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 31st Aug 2007 22:30
lol, I didn't mean section headers like that, I only have SETUP, MAIN LOOP, GOSUBS and FUNCTIONS sections for any program, that's what I meant.
Here's my structure tutorial
http://forum.thegamecreators.com/?m=forum_view&t=111855&b=10

Your signature has been erased by a mod because it was rubbish.

Login to post a reply

Server time is: 2024-11-22 18:40:30
Your offset time is: 2024-11-22 18:40:30