View Full Version : Pathfinding...
is completely confusing to me. I don't get how to make something move in a program. is there a good tutorial on this?
that questions a bit vague...can you be more specific?
can you go into more detail about what you're doing (2d/3d? grid/coodrinate based? c/c++/java?)
obviously pathfinding is about moving something from A to B. if this is a grid based system then its a lot easier, especially in 2d. the only tutorial i could link you to is here (http://www.policyalmanac.org/games/aStarTutorial.htm), although it covers A* pathfinding and may be a bit excessive for what you want to know, if im understanding your question.
im sorry if this is horribly patronising...
well, I'm just trying to get something to move in C++ right now...
ComputerGeek
Oct11-05, 08:17 AM
define "something" and define "move"
are you attempting to move a file in the file system to another location from a C++ program?
jim mcnamara
Oct11-05, 04:09 PM
in stdio.h the rename() function performs an implicit mv command.
Is this what you want?
I want it to be soething like a game. I want the object to move whe a certain key is pressed.
ComputerGeek
Oct13-05, 10:10 PM
I want it to be soething like a game. I want the object to move whe a certain key is pressed.
so, you need to understand vectors and the coordinates of a computer screen (the top left of the screen is the origin.)
neurocomp2003
Oct14-05, 12:31 AM
first off are you doing text grid games, 3D APIs like openGL or directx or SDL(which uses either). That probably the first question you shouhld be answering.
I want it to be soething like a game. I want the object to move whe a certain key is pressed.
it seems from your question that your not sure how to do it in maths, so this should be your first port of call. have a look at this link
http://www.gamedev.net/reference/list.asp?categoryid=28
or im sure there are details on this site.
ah..how to explain this...i wrote out quite a long reply with example code but its quite redundant to do this if i dont understand what you want. ie is this text based? is it from scratch or do you have a library to work from (such as ncurses or one of the lamothe ones)?
usually you have a grid, and accept user input to move left/right/up/down (im asuming you're working in 2d)..
daniel_i_l
Dec3-05, 02:46 PM
To move something you just have to change its position by small amount for a certain amount of times. If you are working with ascii then you can put the cursor in a certain position with the command:
gotoxy(int x,int y);
after using this command, whatever you output will by on that (x,y) position of the screen. To make something move just change it's (x,y) values one step at a time.
vBulletin® v3.7.6, Copyright ©2000-2009, Jelsoft Enterprises Ltd.