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
Click For Summary

Discussion Overview

The discussion revolves around how to implement movement in a program using pathfinding techniques, particularly in the context of game development. Participants explore various aspects of movement, including programming languages, coordinate systems, and user input handling.

Discussion Character

  • Exploratory
  • Technical explanation
  • Conceptual clarification
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant expresses confusion about how to make something move in a program and seeks tutorials.
  • Another participant requests clarification on the specifics of the movement, such as whether it is in 2D or 3D, and the programming language being used.
  • There is a suggestion that pathfinding is about moving an object from point A to point B, with a mention that grid-based systems are easier, especially in 2D.
  • One participant inquires about the definition of "something" and "move," questioning whether the goal is to move a file in the file system.
  • A participant mentions the use of the rename() function in C++ for moving files, questioning if this is what the original poster wants.
  • Another participant clarifies that the movement is intended for a game, triggered by key presses.
  • There are discussions about understanding vectors and screen coordinates, with the top left of the screen being defined as the origin.
  • Participants suggest that the original poster should clarify whether they are working with text grid games or 3D APIs like OpenGL or DirectX.
  • One participant emphasizes the importance of understanding the mathematical aspects of movement before proceeding.
  • A later reply discusses changing an object's position incrementally and mentions the use of the gotoxy() function for ASCII output positioning.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the specifics of the movement implementation, as there are multiple competing views regarding the programming context and methods to achieve movement.

Contextual Notes

There are limitations in the discussion regarding the assumptions about the programming environment, the definitions of movement, and the mathematical foundations required for implementation.

JamesU
Gold Member
Messages
828
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

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 9 ·
Replies
9
Views
3K
Replies
69
Views
12K
  • Sticky
  • · Replies 13 ·
Replies
13
Views
9K
  • · Replies 10 ·
Replies
10
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 16 ·
Replies
16
Views
4K
Replies
40
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K