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 / put the circle on the line and roll it.

Author
Message
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 24th Sep 2003 14:30
Hi all

It's simple what i wish to do but how do you :

1. get two key inputs at the same time. want to press "A" and "'" at the same time and make the line move up the screen or "A" and "?" to make one side go up and the other side go down.

2. make the circle roll up and down the line in relation to the angle of the line plus the speed of roll.

here's the code


cheers.
Watsisname
21
Years of Service
User Offline
Joined: 20th Aug 2003
Location: Wales
Posted: 24th Sep 2003 22:01 Edited at: 24th Sep 2003 22:06
Hi,
I had this problem just recently. The solution is to use the keystate command rather than inkey$. You need to know the scancode of the key you want. There's a DB example called 'Keyboard Control' which could help you here. The codes for the keys you want are:
a - 30
z - 44
' - 40
/ - 53
and here's the code



That's the first part of your question at least. I'm not entierly sure what you mean by the second part. Do you mean like rolling down a hill under gravity or something? Oh well, Hope that helps!
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 25th Sep 2003 02:07
Thanks Watsisname

Just what I was looking for .
The second part is like you said, I want the circle to roll along the line as the line moves up or down, like a ball in a pipe.
trying to get the basic functions to work then I can start to make it 3D. No good running before I can Walk.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 25th Sep 2003 02:25
Hi all

Well the keystate bit works great have got the circle moving left and right with the line but not sitting on it. when there is a steep angle or the speed. have seen some code for speed and gravity but not sure how to put it in the code.

here what I got so far



Cheers
Watsisname
21
Years of Service
User Offline
Joined: 20th Aug 2003
Location: Wales
Posted: 25th Sep 2003 02:57
This seems to do the job



Gravity should be easy to put into something like that. I'll have a go once I've made a cuppa .
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 25th Sep 2003 03:03
Yep thanks, thats got those bits out the way now just the speed bit on a steep angle.

Cheers
Watsisname
21
Years of Service
User Offline
Joined: 20th Aug 2003
Location: Wales
Posted: 25th Sep 2003 03:28
And this one should do gravity



I've corrected a few other small bugs which might have been a problem e.g. I think the default screen width is 640. I can't seem to slow down the circle , maybe it just needs a bit of messing around, or something. Hope that makes sense .
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 25th Sep 2003 03:39
Yep thats it thanks again, now for the fun bit making it look 3D.
very realistic moves just how I want to.

Login to post a reply

Server time is: 2024-09-21 01:10:08
Your offset time is: 2024-09-21 01:10:08