Is there a tutorial on how to make things move in a program using pathfinding?

  • Thread starter Thread starter JamesU
  • Start date Start date
  • Tags Tags
    Tutorial
AI Thread Summary
The discussion revolves around how to make an object move in a programming context, particularly in game development using C++. The initial inquiry is about finding tutorials for movement, which leads to clarifications on whether the movement is in a 2D or 3D environment, and whether it involves grid or coordinate-based systems. The importance of understanding vectors and screen coordinates is emphasized, with the origin being the top left of the screen. For game-like movement, the conversation suggests using user input to change the object's position incrementally. It mentions the use of libraries like OpenGL, DirectX, or SDL for graphics, and highlights the need to clarify the programming environment and the nature of the movement (e.g., text-based or graphical). The discussion also touches on practical coding advice, such as using the `gotoxy` function for text-based movement in a console application. Overall, the key points focus on the necessity of defining the context of movement and understanding basic mathematical concepts to implement it effectively.
JamesU
Gold Member
Messages
821
Reaction score
3
is completely confusing to me. I don't get how to make something move in a program. is there a good tutorial on this?
 
Technology news on Phys.org
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, although it covers A* pathfinding and may be a bit excessive for what you want to know, if I am understanding your question.

im sorry if this is horribly patronising...
 
well, I'm just trying to get something to move in C++ right now...
 
define "something" and define "move"

are you attempting to move a file in the file system to another location from a C++ program?
 
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.
 
yomamma said:
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.)
 
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.
 
yomamma said:
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 I am sure there are details on this site.
 
Last edited by a moderator:
  • #10
ah..how to explain this...i wrote out quite a long reply with example code but its quite redundant to do this if i don't 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)..
 
  • #11
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.
 

Similar threads

Back
Top