Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How would I go about making sprites move?  (Read 2039 times)

0 Members and 1 Guest are viewing this topic.

kingsman142

  • Newbie
  • *
  • Posts: 10
    • View Profile
How would I go about making sprites move?
« on: January 10, 2012, 01:30:40 am »
How would I make a sprite move from one location to another smoothly as in a pong ball from side to side?
OS: Windows 7
SFML Version: 2
Compiler: Code::Blocks with MinGW

Walker

  • Full Member
  • ***
  • Posts: 181
    • View Profile
How would I go about making sprites move?
« Reply #1 on: January 10, 2012, 04:21:42 am »
This is a very simple operation, I suspect you might need to spend some more time learning fundamental programming techniques before you try and jump in the deep end with games and graphics.

You need to increment the sprite's position by some amount every logic update.

aBallofWin

  • Jr. Member
  • **
  • Posts: 99
    • View Profile
How would I go about making sprites move?
« Reply #2 on: January 10, 2012, 11:59:04 am »
Hey kingsman, you probably might not understand what Walker means by that if you're new to sfml or programming, but here is a good tutorial for putting the sprite onto the screen and moving it with the arrow keys http://www.sfml-dev.org/tutorials/1.6/graphics-sprite.php

You can then transfer this to another object by making it move without the arrow keys, by incrementing values depending on the x and y values of the ball. For example: ball.Move(5,5).

More tutorials and that are available at http://www.sfml-dev.org/tutorials/1.6/

Hope this helps :)

 

anything