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 / Setting My 2D Character in a course

Author
Message
Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 24th Sep 2006 03:07
I need my character (a dog) to move by himself, but with a course.
I dont want him to run off screen I want him to move up down, left or right just not off screen!!

Thanks For Your Help!

H4ck1d
18
Years of Service
User Offline
Joined: 27th Dec 2005
Location: Yes
Posted: 24th Sep 2006 04:08
Well you could do two things. First of all, to make it random you could randomly pick a point and then have him move toward it. Then when he gets there, pick a new one and repeat. Or, if you want him to follow a pre-determined path, use "waypoints".

-H4ck1d

Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 24th Sep 2006 15:20
May In have an example please?

Thanks

Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 24th Sep 2006 18:50
I'll whip one up Jordan.


Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 24th Sep 2006 18:59
Thanks!

I am sorry for spamming and posting ridiculous posts, I will not do it again.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 24th Sep 2006 19:11
Another (more complicated/pointless) way of doing it is:

Se5t a random angle and a random distance, and make him walk along that distance at that angle, when he gets to the end, randomize the angle, and randomize the distance. You could calculate the final positions that he would get to if he walked along that line, and if they are outside the screen, then randomize them again.

Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 24th Sep 2006 19:25
Well, I'm in a bit of a rush, so I made the dog ingame...

Hope you can figure most of this out, read through it carefully.




Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 24th Sep 2006 19:26
Xeno,
That wont work for DBC, the box command doesn't have the color functionality.

Xenocythe
19
Years of Service
User Offline
Joined: 26th May 2005
Location: You Essay.
Posted: 24th Sep 2006 19:27
Aww snap, i'm in a rush, someone please fix it?


Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 24th Sep 2006 19:36 Edited at: 24th Sep 2006 19:37
I'll do it!

[edit]
Ah crap, I gtg now, someone else can do it.

Aaron Miller
18
Years of Service
User Offline
Joined: 25th Feb 2006
Playing: osu!
Posted: 25th Sep 2006 03:59
@Jordan
Please attempt to do what it is your asking. Im seriously surprised people reacted positively to this. You've been here about 2 months, and have made (probably) over 50 posts asking for code snippets, giving WIPs that havnt actually been started, and have been banned. There is good reason to you have been banned, now, you are getting better. And it appears that you are trying to be better. But, (maybe i missed something) you need to try to do what you are asking, or have searched, or be completely clueless.


With that aside, waypoints is what you are looking for.

H4ck1d
18
Years of Service
User Offline
Joined: 27th Dec 2005
Location: Yes
Posted: 25th Sep 2006 04:15
Ah, give him a break. There is some truth there, however, it is definitely beneficial for you if you could try to figure some of the code out for yourself. Xenocythe's code looks pretty good, I would imagine you could integrate it into your current project without too much trouble. Good luck, and don't give up!

-H4ck1d

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 25th Sep 2006 21:33
DB User,

It turns out he has, check WIP

Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 25th Sep 2006 22:19
Here, this is how I would go about doing it. I'm not extremely fond of waypoints. This was written in DBC to make sure it would work. Never knew DBC didn't have a rotate sprite command :S




I expect that you would have to change it round a little for it to fit your code, so really, you have to know how it work. Before you ask, please, please please please, study it a bit and try to learn what it all means.

Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 26th Sep 2006 00:54 Edited at: 26th Sep 2006 00:55
My computer froze while I was playing it!

I am sorry for spamming and posting ridiculous posts, I will not do it again.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 27th Sep 2006 02:42
Hmmm... try changing the last parameter of 'Set Display Mode' (2nd line) to 16.

Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 27th Sep 2006 03:19 Edited at: 27th Sep 2006 03:20
The frst 1 right?

I am sorry for spamming and posting ridiculous posts, I will not do it again.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 27th Sep 2006 23:00
huh?

Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 28th Sep 2006 00:37
Do I change the first digit?

I am sorry for spamming and posting ridiculous posts, I will not do it again.
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 28th Sep 2006 19:02
Nope, the last parameter, so it looks like "Set Display Mode 1024,768,16"

Zeus
18
Years of Service
User Offline
Joined: 8th Jul 2006
Location: Atop Mount Olympus
Posted: 28th Sep 2006 23:55
Wait!! I got it!! I used this method.
(this doesn't use a sprite)



Crazy But wrks!!

Thnx Again!

I am sorry for spamming and posting ridiculous posts, I will not do it again.

Login to post a reply

Server time is: 2024-11-27 05:31:07
Your offset time is: 2024-11-27 05:31:07