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 / random movement

Author
Message
Justice
19
Years of Service
User Offline
Joined: 22nd Jun 2004
Location:
Posted: 7th Jan 2015 22:47
Hi,

I have screen dimensions

horizontal. -354 to 1117
vertical. -84 to -700

I want to move smoothly a 3d object randomly around the screen in the dimensions above.

I don't want the object to follow me, just to randomly move around.

Any ideas ?
LBFN
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 8th Jan 2015 02:03
A couple of suggestions:

You could decide what directions are possible for the object to move. You could then pick a random direction and have it take so many 'steps' checking the boundaries to make sure it stays in. Once it completes the steps (or hits a boundary), you pick a new direction and number of steps.

Another way would be to pick a random X / Z coordinate within the boundaries and have it move there. Once it's there, pick another.

So many games to code.....so little time.
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 8th Jan 2015 05:03
Quote: "horizontal. -354 to 1117
vertical. -84 to -700"


Correct me if I am too tired to realise, but is the vertical not off screen completely?

Why the negative numbers?

Anyway I wrote some code for you to grasp the range idea, unfortunately RND() only supports '0 to Number' so I subtracted using positive numbers and subtracted the left side from the right and reduced the numbers accordingly...



Justice
19
Years of Service
User Offline
Joined: 22nd Jun 2004
Location:
Posted: 8th Jan 2015 16:13
Thankyou for your replys, Ill try your suggestions
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 9th Jan 2015 05:12
Here you go, for those negative numbers...



I think you get the idea from that...

Justice
19
Years of Service
User Offline
Joined: 22nd Jun 2004
Location:
Posted: 11th Jan 2015 22:27
thank you very much.
MrValentine
AGK Backer
13
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Jan 2015 01:24
Another happy customer

Login to post a reply

Server time is: 2024-04-25 18:03:09
Your offset time is: 2024-04-25 18:03:09