1
General / Sprite animation question
« on: July 25, 2016, 12:34:47 am »
HI,
I am not a programmer but I enjoy animating my 3d characters ( I work in 3ds Max). I used SDL but I couldnt get my program to work in MSV 2015 C++ after upgrading from MSV express 2010, SFML works fine so far. I found out how to crop images off one of my sprite sheets......
...... I would like to run four or more sprite sheets ( with their associated wav files ) randomly. I'm not sure how to set up the IntRect() to include four or more sprite sheets. Also, I would like to learn how to associate their wav files so they play when the sprite sheet is called. The sprites are the same dimension as my window , but the sprite sheets are 10 across 5 down , 6400 x 2400. Any help would be appreciated.
Thx
I am not a programmer but I enjoy animating my 3d characters ( I work in 3ds Max). I used SDL but I couldnt get my program to work in MSV 2015 C++ after upgrading from MSV express 2010, SFML works fine so far. I found out how to crop images off one of my sprite sheets......
#include <SFML/Graphics.Hpp>
#include <string>
#include <iostream>
int main()
{
sf::RenderWindow Window(sf::VideoMode(640, 480), "sfml test");
Window.setKeyRepeatEnabled(false);
sf::Texture pTexure;
sf::Sprite playerImage;
if (!pTexure.loadFromFile("run_jump.bmp" , sf::IntRect(0,0 , 640 ,480 )))
std::cout << "cant load image" << std::endl;
playerImage.setTexture(pTexure);
while (Window.isOpen())
{
sf::Event Event;
while (Window.pollEvent(Event))
{
switch(Event.type)
case sf::Event::Closed:
Window.close();
break;
}
Window.draw(playerImage);
Window.display();
}
}
#include <string>
#include <iostream>
int main()
{
sf::RenderWindow Window(sf::VideoMode(640, 480), "sfml test");
Window.setKeyRepeatEnabled(false);
sf::Texture pTexure;
sf::Sprite playerImage;
if (!pTexure.loadFromFile("run_jump.bmp" , sf::IntRect(0,0 , 640 ,480 )))
std::cout << "cant load image" << std::endl;
playerImage.setTexture(pTexure);
while (Window.isOpen())
{
sf::Event Event;
while (Window.pollEvent(Event))
{
switch(Event.type)
case sf::Event::Closed:
Window.close();
break;
}
Window.draw(playerImage);
Window.display();
}
}
...... I would like to run four or more sprite sheets ( with their associated wav files ) randomly. I'm not sure how to set up the IntRect() to include four or more sprite sheets. Also, I would like to learn how to associate their wav files so they play when the sprite sheet is called. The sprites are the same dimension as my window , but the sprite sheets are 10 across 5 down , 6400 x 2400. Any help would be appreciated.
Thx