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 / Holding down a key

Author
Message
Mr Pham
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: TOOOROONTOO!
Posted: 30th Sep 2003 03:02
I want to rotate my model. But when i do, i can only hit the rotate key (left key) once. how do i make it so, i can hold down the left key and it wouldnt stop rotating?

thx a for the help

If you can't amuse people with your intelligence, confuse them with your stupidity
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 30th Sep 2003 03:19
put a condition check for the specific key(s) in the main loop. If the key is being pressed rotate the model 1 degree in that direction, if the other key is being pressed rotate in the opp direction.

psuedo code:

load my model

DO
if LeftKeyIsPressed then obj ang x = obj ang x-1
if RightKeyIsPressed then obj ang x = obj ang x+1
LOOP

end psuedo code


you get the idea

-RUST-
Mr Pham
21
Years of Service
User Offline
Joined: 28th Sep 2003
Location: TOOOROONTOO!
Posted: 30th Sep 2003 07:09
Whast a condition check, i am a uber n00b, ph33r me!!

heres my code for the movement thigny.

If you can't amuse people with your intelligence, confuse them with your stupidity
Flashing Blade
22
Years of Service
User Offline
Joined: 19th Oct 2002
Location: United Kingdom
Posted: 30th Sep 2003 14:18
These lines just rotate your object to an angle of 2o or -2o:

if scancode()=200 then yrotate object 1,2
if scancode()=203 then yrotate object 1,-2

Change to:

if scancode()=200 then yrotate object 1,wrapvalue(object angle y(1)+2)
if scancode()=203 then yrotate object 1,wrapvalue(object angle y(1)-2)

.

Login to post a reply

Server time is: 2024-11-10 19:29:35
Your offset time is: 2024-11-10 19:29:35