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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - masterassassin1398

Pages: [1]
1
Graphics / Re: Tile Map Example Help
« on: November 07, 2014, 11:18:10 pm »
No i havent tried running it myself.  I figured that i would need the texture for the tiles.  I will go ahead and try though.  Overall i dont have anything specific i am curious about.  I just need a more detailed walkthrough than what is offered.

2
Graphics / Tile Map Example Help
« on: November 06, 2014, 11:23:25 pm »
Hi guys.  I need some help.  Im trying to make a tile map game, using sfml.  Currently i am using sfml 2.1, the designing entities with vertex arrays tutorial for tile maps is really confusing for me.  I was wondering if anyone could break it down for me.  I know its a lot of work but it would be extremely helpful.  Thanks in advance.

3
Graphics / Re: Transparancy and Animations Help??
« on: October 08, 2014, 08:51:00 pm »
Thank you guys =)

4
Graphics / Transparancy and Animations Help??
« on: October 08, 2014, 07:34:49 pm »
Hello all, I have been working on a little 8-bit game recently and i have been struggling with animations and actually making my sprites have a transparent background.  For the animations i have tried to loop through some images but it runs too quickly for that.  If anyone has any tips that would be greatly appreciated.  However for the transparency i went to the documentation for color and into my code put this:
sf::Color transparent(192, 192, 192);
transparent.a = 0;

Now on my texture i use this exact same rgb combination and it turns out to be a light gray.  However i am using microsoft paint and i dont really want to use anything else like photoshop because i dont know how to use it.  Again if anyone has some recommendations for me to correct me and guide me on the right path it would be greatly appreciated.  I can also give more code if needed to see.  Thank you.

5
Graphics / Re: SFML textures not loading
« on: October 08, 2014, 05:48:30 pm »
Thank you  :)

6
Graphics / Re: SFML textures not loading
« on: October 08, 2014, 12:46:04 am »
Ahh yes of course I totally missed that.  And ya it kinda makes sense.  I will have to look into it more.  Thank you.

7
Graphics / SFML textures not loading
« on: October 07, 2014, 08:03:29 pm »
Hiya.  I am having some problems trying to load my texture file.  I dont fully understand textures at all i dont feel that the tutorial is as descriptive as i would want it to be as far as what a texture is and what it is used for.  The way i am interpreting it is that its an image with a bunch of (for example characters) things on it and a sprite is an individual thing(character).  Im so confused =/  Anyway i am using codeblocks and c++.  My image is within the same file as my exe and everything else, i added the image file to my codeblocks project but that didnt seem to do anything.  Im not sure what else i could do.  Can anyone tell me what a texture is and how to use it?  And also what might be wrong with my code?  The reason it says its not working is because it is unable to open file.

Code:
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <iostream>

using namespace std;

int main(){
sf::RenderWindow window(sf::VideoMode(800, 600), "Insomnia");
window.setPosition(sf::Vector2i(0, 0));
sf::Vector2u size = window.getSize();
unsigned int windowLength = size.x;
unsigned int windowWidth = size.y;

while(window.isOpen()){
    sf::Texture texture;
    if(!texture.loadFromFile("TextureImage")){
        return 1;
    }

    sf::Event event;
        while(window.pollEvent(event)){
            if(event.type == sf::Event::Closed)
                window.close();
        }

    if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape)){
            window.close();
        }

        window.clear(sf::Color::Black);

        window.display();
}
return 0;
}

 

8
General / bullet shooting help?
« on: August 26, 2014, 03:52:23 pm »
I have this game i am working on and the bullet on screen is having a small error. It shoots one bullet at a time, and when the ships y coordinates are over 200 it shoots fine. When they are under 200 it jumps and shoots from there. If anyone can check out my code or test it themselves and give me any words of advice that would be very helpful thank you. Comment out the background image and just draw the shapes if needed =) i was trying to debug this problem but it has gotten frustrating. thanks

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <iostream>

using namespace std;

//declare variables
int movex = 0, movey = 0;
int bulletx, bullety;
bool bulletActive = false;

//create functions
void moveUp(){
movey -= 10;
}
void moveDown(){
movey += 10;
}
/*void moveLeft(){
movex -= 10;
}
void moveRight(){
movex += 10;
}*/


//main function
int main()
{
//create the window
sf::RenderWindow window(sf::VideoMode(900, 700), "My window");

//declare functions
sf::Thread movUp(&moveUp);
sf::Thread movDown(&moveDown);
//sf::Thread movLeft(&moveLeft);
//sf:: Thread movRight(&moveRight);

while(window.isOpen()){

//Loads up the background
sf::Texture texture;
texture.loadFromFile("space_background2.jpg");
sf::Sprite background;
background.setTexture(texture);
background.setScale(1.0f, 1.0f);

//create the hexagon(originally triangle)
sf::CircleShape triangle(30, 6);
triangle.setFillColor(sf::Color::Blue);
triangle.setPosition(movex, movey);
triangle.setOrigin(0, 0);

//create the enemy
sf::CircleShape enemy(20, 3);
enemy.setFillColor(sf::Color::Yellow);
enemy.setPosition(800, 300);

//create the bullet
sf::CircleShape bullet(5);
bullet.setFillColor(sf::Color::Red);

//close button
sf::Event event;
while(window.pollEvent(event)){
if(event.type == sf::Event::Closed)
window.close();
}

//keyboard controls
/*if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)){
movRight.launch();
}
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)){
movLeft.launch();
}*/

/*else*/ if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)){
if(movey <= 300)
movDown.launch();
}
else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)){
if(movey >= 15)
movUp.launch();
}

if (sf::Keyboard::isKeyPressed(sf::Keyboard::Space)){
//shotBullet.launch();
if(!bulletActive){
bulletActive = true;
bulletx = movex;
bullety = movey;
bullet.setPosition(bulletx, bullety);
}
}

//if the bullet is active keep going until it reaches 950 then delete it
if(bulletActive){
bulletx += 60;
if(bulletx > 950)
bulletActive = false;
}
//move then draw everything
window.draw(background);
bullet.move(bulletx, bullety);
triangle.move(movex, movey);
window.draw(triangle);

sf::FloatRect bulletBox = bullet.getGlobalBounds();
sf::FloatRect enemyBox = enemy.getGlobalBounds();
if(!bulletBox.intersects(enemyBox)){
window.draw(enemy);
if(bulletActive)
if(bulletx > 50)
window.draw(bullet);
}
if(bulletBox.intersects(enemyBox))
bulletActive = false;

window.display();


}
return 0;
}
 

Pages: [1]