Getting Dink to walk to a location
Question for you Dinkers out there. Anyone know how to get Dink to walk to a specific spot when you don't know where on the map screen you are?
Sure, it's not that hard.
First you make Dink walk to the X coordinate of the destination point, then to the Y coordinate For the direction in the move() command, you need to determine whether the destination point is above, under, right or left of the player. You can use simple if() conditionals for this.
If you need pathing it becomes a lot more complicated and I can't really help with that.
I can provide more information and maybe an example if you don't understand what I'm trying to say^^
First you make Dink walk to the X coordinate of the destination point, then to the Y coordinate For the direction in the move() command, you need to determine whether the destination point is above, under, right or left of the player. You can use simple if() conditionals for this.
If you need pathing it becomes a lot more complicated and I can't really help with that.
I can provide more information and maybe an example if you don't understand what I'm trying to say^^
move_stop(1,2,200,1); move_stop(1,8,200,1); move_stop(1,4,200,1); move_stop(1,6,200,1);
^ This works too, though it can be rather inelegant. (Dink'll walk right through houses, rocks, etc)
Well, in the editor, you can put your mouse over a spot, and in the bottom corner it should tell you the coordinates. So, remember those, write them down on a scrap of paper or something and then use your move(); command.
Hmm... moving him is not a problem. It's just that if you enter this screen on the bottom you need to walk UP. If you enter this screen on the left hand side you need to walk right. How do you get the engine to move it correctly when you don't know which side you entered from?
Kyle: You touched on figured out with if statements your starting point. Anyone know what command to run to figure that out?
Kyle: You touched on figured out with if statements your starting point. Anyone know what command to run to figure that out?
You could put sprites in at the entrance. So as soon as dink enters, you get the void touch command and then move him from there. It'd be redundant but I'm not a master of DinkC so someone else probably has an easier way to do it.
Alright, so the way it works is this:
Do the same for the y-coordinate. Does this make sense?
&dinkx = sp_x(1, -1); &dinky = sp_y(1, -1); if (&dinkx > 200) // Dink is now on the right side of the desired point move(1, 4, 200, 1); if (&dinkx < 200) // Dink is now on the left side of the desired point move(1, 6, 200, 1);
Do the same for the y-coordinate. Does this make sense?
That's perfect Kyle... I was having issue figuring out HOW I can get the X & Y coordinate. From there it's just using some if statements to get Dink where I need him. Thanks for the help!
My pleasure bsitko Come back if you have more questions, we'll still be here^^
Kyle.. you've been hanging around since 2000 and you've only got 2 DMOD's? Get WITH IT MAN! Ha!
And one is a demo!
I'm working on one, but unfortunately adult life hit me in the face with a 40 hour work week. Having not worked before, it was a hard slap
I'm working on one, but unfortunately adult life hit me in the face with a 40 hour work week. Having not worked before, it was a hard slap
I hear you on that one. Add 2 kids into the mix and you've got one heck of a busy schedule. Although I've been trying to find time to work on ... something.