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 - Assassinbeast

Pages: 1 2 [3] 4 5
31
SFML projects / Re: My new game released!! HUNGRY SNAKE 1.0
« on: November 13, 2012, 03:43:07 pm »
Quote
After some seconds of gameplay this happens (attachment). However, the game still remains playable.

Hmm... i have to fix that somehow  :-\

32
SFML projects / Re: My new game released!! HUNGRY SNAKE 1.0
« on: November 13, 2012, 12:39:56 pm »
Quote
Very nice.  I played a little bit today; will play more tomorrow.

Thank you   :D

Quote
  1. There is no music during the main segment. Maybe you can add some 'tense' music when one is about to die.

Hmm yes, theres still alot of improvements i have to make   ;D

33
SFML projects / Hungry Snake 1.1 Released!!!
« on: November 13, 2012, 12:00:42 am »
Hungry Snake 1.1 is now released!

download at:
http://www.mediafire.com/?u8ucz7m1lucalq3

Changelog:
- Rat stealing your food
- Healthpack
- Some other minor bugfixes, balances and features


Remember to uninstall the 1.0 if you have it... because i dont know how to make it able to update instead of installing a whole new version.

Also, A big thanks to you all for helping me in the forum, especially to exploiter!!  :D

Images & Sounds Credits goes to:

Tibia
http://www.freesound.org/
Google

34
Window / Re: RenderWindow not appearing?
« on: November 12, 2012, 01:03:12 am »
i think you forgot to link the dll files under linker > input > additional Dependecies.

just include this: (for 2.0., but maybe 1.6 is the same)

sfml-main-d.lib
sfml-system-d.lib
sfml-window-d.lib
sfml-graphics-d.lib
sfml-network-d.lib
sfml-audio-d.lib

Im using sfml 2.0 and in 2.0, window.isopened() is wrong
its window.isopen()

35
General / Re: need help with a weird problem (working with files)
« on: November 10, 2012, 11:11:57 pm »
It is quite long since i used it. Not sure if it is the same. In windows there is this function call

SHGetKnownFolderPath(...)

You can use that function to get the path to the user documents folder.

Here is a link to msdn. Do note this would need vista and above

http://msdn.microsoft.com/en-us/library/bb762188%28VS.85%29.aspx

regards

wow... i have no idea how to use that  :-\
can you show me how write and use the code plz?  ::)

36
General / Re: need help with a weird problem (working with files)
« on: November 09, 2012, 10:15:43 pm »
Your video upload is wrong. You uploaded the shortcut instead of the actual video.

Where are you writing the file to? As Sui stated, have you tried writing to My Documents or Application Data instead?

Ahh... sui said if i install it to c/ drive, its wrong. Thats what i did. so i think thats the case why i cant save my new data in the highscore.txt as hes saying that its a protected folder.

So i just tried to install the highscore.txt to my documents. But my program wont load it because the file is in my documents folder.

What code should i write so my program know that it should load the highscore.txt in the documents folder?

37
General / Re: need help with a weird problem (working with files)
« on: November 09, 2012, 09:19:36 pm »
Help anyone?  :'(
Its just saving a highscore.... how hard can it be?

http://www.mediafire.com/?fznd6a4oirocrwp

i made this vid to show exactly how strange this is...
In the vid... it looks like the highscore.txt cant be changed by me or by the program... thats what i think it is  :-\

So when i made  a new highscore.txt on the desktop and replaced it with the new one, then the original highscore.txt that was protected and couldn't be changed, got deleted and replaced with a highscore.txt that can be modified by me and the program.

but its just a guess  :(

Aint anybody making games and work with files like me? i mean... come on, help me!!!  :-\

38
General / Re: need help with a weird problem (working with files)
« on: November 08, 2012, 12:08:29 am »
i uploaded it on mediafire   :)

http://www.mediafire.com/?fznd6a4oirocrwp

So at the end, i just showed that it was possible to edit the highscore.txt when i copied it into my programs folder. And also, i couldn't edit the original txt. file. The game could load it, but not save anything in it.

Hope this video will show you exactly what horrible thing ive done wrong  ;D
But also, i want to make it unable to change the txt file or replace it with other txt files. How do i do that? Because my friend is probably gonna do it if he finds out its possible  ::)

39
General / Re: need help with a weird problem (working with files)
« on: November 07, 2012, 10:56:54 pm »
I just tried to use Inno Setup, and the same thing happends
I think the main problem is that the highscore.txt cant be changed.

So i have to make a new highscore.txt on the desktop and put it in the program and replace it with a normal txt file that can be changed

i can try to make a vid and show you exactly how strange this problem is :S

How can i upload files on the forum? because i really wanna show it  :P

40
General / Re: Grid-based sprite movement
« on: November 07, 2012, 07:21:02 pm »
Hey, there are many ways to make this, but since im a newb myself and have never done it before, i will take up the challenge   8)

There are better ways to do this, but i think this is a pretty good start  ;D
If you put the speed too high up, then its kinda gonna lag a little between each set of tile movement.

You can of course fix it by making some extra booleans about when you are able to walk again, but i wont show you since its gonna be too detailed then.

Exploiters description is a much more efficient way to make it, but its kinda hard to understand if u dont even know how to make a simple tilewalking code to work

#include <SFML/Graphics.hpp>

sf::RenderWindow mywindow(sf::VideoMode(800,600,32),"title");
sf::Event ev;

int tilesize = 50;

class character
{
public:
        character()
        {
                x = 0;
                y = 0;
               
                // in this case, every loop, it will walk 2 pixels.
        //if u put 50 as movespeed, it will walk 1 pixel each loop
                movespeed = 100.0 / tilesize;

                for(int i = 0; i < 4; ++i) //initialize the all move booleans to false
                        move[i] = false;

                walking = false;
                myrect.setSize(sf::Vector2f(50,50)); //size 50 by 50, same as every tile
        }

        void keymove(); //keypress detection
        void moving(); //moving if "walking" boolean is true

        float x;
        float y;
        float movespeed; //sets the movespeed

        enum MOVE {UP,DOWN,LEFT,RIGHT}; //enums instead of remember numbers
        bool move[4]; //deciding if u move up/down/left/right
        bool walking;
        int nextspot; //the next tilespot of the map

        sf::RectangleShape myrect;
};

void character::keymove()
{
        /*keymove() and moving() functions are working together*/
        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
        {
                if(walking == false)
                {
                        /*if you click up, the the nextspot will of course be 50
                        pixels above yourself, so thats why nextspot = y - tilsize*/

                        nextspot = y - tilesize;
                        /*this is gonna make sure you cant have move[UP] and move[LEFT]
                        true on the same time so u wont walk 45 degrees*/

                        move[UP] = true;
                        walking = true;
                       
                }
        }

        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
        {
                if(walking == false)
                {
                        nextspot = y + tilesize;
                        move[DOWN] = true;
                        walking = true;
                }
        }

        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
        {
                if(walking == false)
                {
                        nextspot = x - tilesize;
                        move[LEFT] = true;
                        walking = true;
                }
        }

        if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
        {
                if(walking == false)
                {
                        nextspot = x + tilesize;
                        move[RIGHT] = true;
                        walking = true;
                }
        }
}
void character::moving()
{
        if(walking == true)
        {
                if(move[UP] == true)
                {
                        y -= movespeed;

                        /* i do <= and not just == because maybe your movespeed has a
                        decimalpoint and then it wont become the same number as nextspot*/

                        if(y <= nextspot)
                        {
                                y = nextspot;
                                walking = false;
                                move[UP] = false;
                        }
                }

                if(move[DOWN] == true)
                {
                        y += movespeed;
                        if(y >= nextspot)
                        {
                                y = nextspot;
                                walking = false;
                                move[DOWN] = false;
                        }
                }
                if(move[LEFT] == true)
                {
                        x -= movespeed;
                        if(x <= nextspot)
                        {
                                x = nextspot;
                                walking = false;
                                move[LEFT] = false;
                        }
                }
                if(move[RIGHT] == true)
                {
                        x += movespeed;
                        if(x >= nextspot)
                        {
                                x = nextspot;
                                walking = false;
                                move[RIGHT] = false;
                        }
                }
        }
}
int main()
{
        mywindow.setVerticalSyncEnabled(true); // 60 fps
        character pacman; // a squared pacman
    pacman.myrect.setFillColor(sf::Color(255,255,0));
        while(mywindow.isOpen())
        {
                while(mywindow.pollEvent(ev))
                {
                        if(ev.type == sf::Event::Closed) mywindow.close();
                }

                pacman.keymove();
                pacman.moving();
                pacman.myrect.setPosition(pacman.x,pacman.y);

                mywindow.clear(sf::Color(0,200,0));
                mywindow.draw(pacman.myrect);

                mywindow.display();
        }
}
 

Hope you like it  :)

41
General / Re: need help with a weird problem (working with files)
« on: November 07, 2012, 04:49:50 pm »
Im using windows and vc 2010.

1) What installer are you using?

Advanced Installer

2) Is your installer really copying all the files needed?

I included all the dll files e.g sfml-graphics-2.dll , and all the 6 other dlls (so 7 dll.s)
And then i include the my font and highscore.txt. But if i include the highscore.txt, and make the installer, then i can only open it, but not save it. I know i can open highscore.txt because i put "1" in highscore.txt and it shows highscore: 1 (and not 5 because thats what i made it default).

And if i dont include the highscore.txt, then i make the installer, install on my computer and then i have to make a new highscore.txt (e.g on my desktop) and put it in my c drive where i installed the program (where the font and cpp is).

Then it can save and work perfectly
Sooooooo strange  :-\

3) Do you need administrator rights on the destination folder?

I dont really know what u mean by that. But i couldn't change the highscore.txt directly inside the program(where the fonts and dlls are), but i could make a highscore.txt(on the desktop) and then put it in the folder where the current highscore.txt is and replace it with the new one( which works and its like cheat if u want to change the highscore).
But i think it was the administrator rights when i had to do that, because i get a message and it said something like that.

4) You should check if your file can be opened

Yes, it opens, but its not saving. (only if i make the installer and dont include the highscore.txt, and after i install it, i have to make a highscore.txt in my desktop and put it in the program(where the font and dlls are) THEN IT WORKS.... SOOOOOO STRANGE


im so confused right now :/
Also... can u recommend me some other installers that i should try out, maybe that would solve the problem  :-\ Because it works when im debugging, but not when i have installed it and run it.

But thanks alot, i appreciate your help so so much  :)

42
General / need help with a weird problem (working with files)
« on: November 06, 2012, 11:18:54 pm »
Hello everybody  :)
I have the weirdest problem when im working with files and saving them as highscore.

It took me about 3 hours to figure out why sometimes it would save the highscore on the harddrive, and why sometimes it woulnd't when i have to release and make an installer for it.

It works perfectly when im debugging it on my own computer, but not when i make an installer for it.

So my question is, is this how to work with files?

#include <SFML\Graphics.hpp>
#include <fstream>
#include <string>
#include <sstream>

sf::RenderWindow mywindow(sf::VideoMode(800,600,32),"ddsada");
sf::Event ev;
sf::Font myfont;

sf::Text t_score;
sf::Text t_highscore;
int score = 0;
int highscore = 5;


template <typename T>
std::string toString(T arg)
{
        std::stringstream ss;
        ss << arg;
        return ss.str();
}

int main()
{
        mywindow.setVerticalSyncEnabled(true); //60 fps
        myfont.loadFromFile("thefont.ttf");
        t_score.setFont(myfont);
        t_highscore.setFont(myfont);
        t_highscore.setPosition(0,50);

        std::ifstream inputfile("highscore.txt");
        inputfile >> highscore;
        inputfile.close();

        while(mywindow.isOpen())
        {
                t_score.setString(toString("Score= ") + toString(score));
                t_highscore.setString(toString("Highscore= ") + toString(highscore));

                while(mywindow.pollEvent(ev))
                {
                        if(ev.type == sf::Event::Closed || ev.key.code == sf::Keyboard::Escape)
                                mywindow.close();
                }
                mywindow.clear(sf::Color(0,200,0));

                score++;
                mywindow.draw(t_score);
                mywindow.draw(t_highscore);

                mywindow.display();
        }

        if(score > highscore)
        {
                std::ofstream outputfile("highscore.txt");
                outputfile << score;
                outputfile.close();
        }

}
 

So when i make an installer for it... it actually doesn't work when i include the highscore.txt (and the dll files) and make the installer for it.

It only works when i include the files i need (the dll files) and after i install it, then i have to make a new highscore.txt file (eg. in my deskop) and then put it in my c drive where the program actually is (where the font and dll files are).


Sorry, theres alot of reading and text. But im very very close to make my game fully functional and i want to show it to you all  ;D.

I just cant make this file thing to work  >:(

43
General / Re: How do i make an installer for my sfml 2.0 game?
« on: November 06, 2012, 08:55:27 pm »
Thanks  :)

44
General / How do i make an installer for my sfml 2.0 game?
« on: November 05, 2012, 11:10:16 pm »
Good evening   ;D

I just finished my game and i want to show it to my friend.
How do i make and installer for it?

I know how to do it with allegro. i used "Advanced Installer" and i just had to include some redistributable files and some allegro dll. files.

But what should i include with sfml?


45
Window / Re: How do you make the keyboard just click one time? (SFML 2.0)
« on: November 04, 2012, 03:10:08 pm »
sorry, forgot there were tutorials  ::)

Pages: 1 2 [3] 4 5