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

Pages: [1] 2
1
Graphics / Re: Circular movement
« on: February 04, 2014, 11:11:04 pm »
If its too fast you should reduce the speed you multiply with.

Sorry, maybe Im very confused now. I know that I have to reduce the speed, but the problem is: Nothing is multiplied with "Speed" (have a look at the code).
The main question is: How can I integrate the "Speed" into the code? You understand? Sorry for my english. :(

Also dont make logic updates dependent on tinkering with the framerate. And preferably use fixed timesteps.

I know. Im still learning.

2
Graphics / Re: Circular movement
« on: February 04, 2014, 04:21:20 pm »
Are you time limiting your game somehow? If not, then its going to go as fast as you computer can run through the loops

Hey :)

Yes, its limited on 60 FPS.

And its still too fast. I want to make a slow movement with:
Speed = 300.f;
so how can I do this? ._.


3
Graphics / Re: Circular movement
« on: February 03, 2014, 07:36:30 pm »
Hey,

can nobody help me? I have just a problem with time control. If I press "Space", its move really fast. And I dont have any Idea, how I can solve this. :(


sr = 100; // radius
st = 0; // angle

sx = sr*std::cos(st);
sy = sr*std::sin(st);

if(Keyboard::isKeyPressed(Keyboard::Space))
{
        st++;


        //stone.setPosition(  stone.getPosition().x + sx,
        //                                      stone.getPosition().y + sy);

        stone.move(  sx, sy);


}

4
Graphics / Re: Circular movement
« on: January 26, 2014, 02:12:15 pm »
Thank you. Sorry for my late replay. I studied hard and I got it now. :)

Thats my code:

       
sx = sr*std::cos(st)*(Speed*ElapsedTime);
sy = sr*std::sin(st)*(Speed*ElapsedTime);

if(Keyboard::isKeyPressed(Keyboard::Space))
{
st++; // mini example
stone.setPosition(  stone.getPosition().x + sx,
                               stone.getPosition().y + sy);
}

But it moves too fast. How can I solve this? I cant use "sr*std::cos(st)*(Speed*ElapsedTime)" because its increase/decrease the value. :(

kursukia

5
Graphics / Re: Circular movement
« on: January 13, 2014, 11:41:57 pm »
stonex and stoney are not the angle. An angle is the direction in which you are pointing. In degrees angles range from 0 to 360. Think of a compass, there is north, east, south, and west that are all 90 degrees from each other. That is why I included a small representation of angles in my first post.

puh.. I really understand you. But I have no idea, how I can do that. ._.

6
Graphics / Re: Circular movement
« on: January 13, 2014, 08:45:10 pm »
Code: [Select]
X = sin(angle) * speed
Y = cos(angle) * speed

Don't forget that if you use std::sin and std::cos it takes radians, not degrees.  ;)


Hello,

allright, thank you. But.. can you exactly tell me what "angle" is in this code?

Edit:

Its a little bit strange.. is this wrong?

        float stonex = stone.getPosition().x;
        float stoney = stone.getPosition().y;


        float angle = stonex/stoney;

        x = std::sin(angle) * Speed;
        y = std::cos(angle) * Speed;

        stone.setPosition(x,y);
        std::cout << x << " " << y << std::endl;

7
Graphics / Circular movement
« on: January 13, 2014, 06:25:33 pm »
Hello,

I want to let move circle in a circular path. How can I do that?

I tried this. It works, but this was not the solution for my problem => its completly wrong:

        //if(stoney <= 100){down=true; up=false;}
        //if(stoney >= 350){down=false; up=true;}

        //if(down==true,up==false)
        //{
        //      stone.move(0,Speed*ElapsedTime);
        //}
        //else if(down==false,up==true)
        //{
        //      stone.move(0,-Speed*ElapsedTime);
        //}

        //if(stonex <= 125){right=true; left=false;}
        //if(stonex >= 375){right=false; left=true;}

        //if(right==true,left==false)
        //{
        //      stone.move(Speed*ElapsedTime,0);
        //}
        //else if(right==false,left==true)
        //{
        //      stone.move(-Speed*ElapsedTime,0);
        //}

        //std::cout << "X: " << stonex << " Y: " << stoney << std::endl;

I think, I have to work with sin and cos, but I dont know how I can do that..

kurs

8
Graphics / Re: two questions: "collision-stop-detect" and "random move"
« on: January 07, 2014, 10:17:17 pm »
Hello :)

Thank you. I found the solution myself and its a bit the same like yours.

pseudo code:

move A,
move D,
move W,
move S

if collision with box // <- globalbounds
setPosition // <- just "setPosition"
else
//nothing// <- nothing :P
 


so for over classes I going to use a simply void:

collisionCheck(player) //or something similar, dont know

and I going to put ALL boxes into one cpp class file. For every sprite to check the same code.

it was really really simply. Thank you very much. :)

Edit:

To check all objects, my code is not really effective I think. I didnt try out.

But I would do this method:

Pseudo code main.cpp / game.cpp:

treeObjectSprite, houseObjectSprite, stoneObjectSprite, (...)

objectList, objectIterator

treeObjectSprite pushback objectList
houseObjectSprite pushback objectList
stoneObjectSprite pushback objectList

collision.cpp
for objectList size ++ something
{
   if player globalbounds objectList[iterator]
   {
      setPosition player
   }
   else
   {
   // nothing
   }
}

But.. would do work this? Is there a better method to do this? For example, I have at "level 1" over 25 objects.

This method would be really effective, if it works. I can try this out in the evening (its 10 am here now) to test if it would work this.

kursukia

9
Graphics / Re: two questions: "collision-stop-detect" and "random move"
« on: January 06, 2014, 04:44:56 pm »
The basic idea is to "simulate" the movement e.g. calculate the position of the next frame and only move if it is valid.

Kind Regards

Hey Raincode,

just like this?

if (!object.getglobalBounds intersects player globalbounds)
{
    if(keyboard::isPressed(......)

}
else
{
// nothing
}

kursukia

10
Graphics / two questions: "collision-stop-detect" and "random move"
« on: January 06, 2014, 10:31:39 am »
Hello!!

Im working on new projects and there is two things that I dont understand.

Question 1:
I know how I can make a Collision with this Code:
object.getGlobalBounds().intersects( player.getGlobalBounds()....

I know, how I can "destroy" the object or the player, set a other position for the players etc.

But.. if I want to make a 2D-RPG game, how should the Code looks like, if I want that the Player "stops" to the object? Should I work with booleans? I never implented this and I have no idea how I can do this.
I think, I would do this (pseudo code):

if (object.getglobalBounds intersects player globalbounds
   &&pressRight=true)
{
   Walkspeed = 0;
}
else if(object.getglobalBounds intersects player globalbounds
   &&pressRight=true)
{
   Walkspeed = 0;
} //(...)
else
{
   Walkspeed = X
}

or this:

if(...) &&right=true
{
 move(x-1,y)
}

But I know its stupid and wrong, and I dont know if this stupid code is working.
Can you tell me, how you do this? How you create a Code that the player "stops" at the objects?

Question 2:

This is a bit more complex (maybe..): I want to give every Sprite his own moves.

For example, please have a look at this pseudo code:

timer >= 100
{

randomz = rand() % 5 + 1;

if(randomz = 1)
  randomx = 5, randomy  = 3;
if(randomz = 2)
  randomx = -2, randomy = -5;
(...)

Create Sprite process

sprite*move(randomx, randomy)
timer = 0
}

The problem is: I dont know, if every sprite get his "own" move, or its a "global move" like: movement is changing every time for all sprites.

Kursukia :)

Sorry for my broken english!

11
Window / Re: Problems to record my game
« on: December 29, 2013, 08:57:34 pm »
Hello,

okay. I going to make this for my future project. Thank you. :)

kursukia

12
Window / Re: Problems to record my game
« on: December 29, 2013, 01:21:39 pm »
Hello zsbzsb,

thank you for your reply.

Thats the main solution. But do you have a "example" what you exaclty mean with "delta-time"?
Its a "non-hardware-based time"? Or "real-time-based time"? Or im completly wrong?

kursukia

13
Window / Re: Problems to record my game
« on: December 29, 2013, 10:30:28 am »
Hello eXpl0it3r,

I used your gravity example and its working without problems.

I tried to use a similar code of my game, but the gravity dont works = its "too slow". I really think, the problem is, that my game needs over 4000 FPS to works well. So if the FPS going limited by window.setFramerate(60), by FRAPS (60 FPS) or MSI (100 FPS), so my game dont works well anymore. I think, thats the problem. But I dont know, how I solve this. Maybe its caused by my time-process? I would show you some parts of my code:

main.cpp:
        float ElapsedTime = clock.restart().asSeconds();
        spawnTime+=ElapsedTime;
        animationTime+=ElapsedTime;
        //(...)
        if(spawnTime>=3.0)
             spawnTime= 0; // I write this because I think its causing lags
        //(...)
 

main.cpp:

                if(start==false &&gameOver==false)
                {
                        gui.DrawStart(window);
                }
                if(start==true &&gameOver==false)
                {

                        if(player.life<=0)
                        {
                                start=false;
                                gameOver=true;
                        }

                        // main process of game, im using only void for all processes

                }
                else if(start==false &&gameOver==true)
                {
                        gui.DrawFinish(window);
                }
                else
                {
                      // nothing at first moment
                }
 

Its my first project that im working with full classes (at all, its my second game project). I know its not 100 % clean, but Its for my practice. :(

I hope, you can me tell more. If you need more, I can post it.

kursukia

edit & ps: WinXP = I know. Im going to change next year (1- 2 month) to windows 7 home :) So its time to say goodbye to WinXp. My personally beautiful office os. :)

edit 2: I think, i going to "slow down" some variables to adjust it to 60 FPS. I going to try it. I post in few hours a reply to tell you, if its work. Normally that should to be the solution.

Final Edit:

Now its working well. :) I limited the FPS to 60 with window.setFrameRate... from unlimited / 4000 fps and adjust my variables (decrase speed, gravity variables and timer and so on) to fps 60 and now its working all fine.

The only on not so good think is, that the movement of enemys and player are not smooth anymore. So FRAPS says the game have 30 FPS. If I record, the FPS is jump to 60 FPS and all movement is smooth.
What I see too: The timer is suddenly work "faster" if the FPS is on 60.

So I found a "balance": I set the frameLimit to 70 - 90 for windows and the movement is smooth plus the timer is not going too crazy. FRAPS says 64 FPS without recording, and 90 FPS on recording. But is this normal? Its normal that the timer is working faster if the FPS is higher? Its interesting too see whats happening for my experience. :)

Kursukia

14
Window / Re: Problems to record my game
« on: December 29, 2013, 12:08:14 am »
Hello eXpl0it3r,

thank you for your reply.

I try to explain:

Its a game with enemy respawn and gravity (so the "player" can jump with space). All works fine.
But if I starts a record tool, is will happen this:

The enemys dont spawn every 5 seconds anymore (for example, but its like they spawn all 30 seconds, but I dont check if the enemy is spawn again), or if you jump, you jump suddenly higher than normal.

Im feel a little bit shame, but I cant use "Open Broadcaster Software", because I have Windows XP, and it needs Windows Vista to run it.

kursukia

15
Window / [solved]Problems to record my game
« on: December 28, 2013, 11:05:48 pm »
Hello guys,

I have a exotic problem that I cant record my created app.

I cant use FRAPS, and some other recording-tools for record my selfcreated game.
If I start to use the record-tool, its like my game have a super fps-dropdown, all is going slown.
Its happening with all record tools that im tested: Fraps 19D, Fraps 3.5, MSI afterburner and camtasia studio.

But if I show someone via Skype my game, so I dont have this problems.

Can you tell me, what this problem is caused?
I tryed with FrameLimit and without FrameLimit. The maximum setting on Fraps is 60 FPS, and on MSI afterburner with 100 fps. But still the same problem. The whole game is going crazy. So if I use FRAPS, it shows me over 4500 fps.

I really dont know what code I should post. Please tell me it. The whole project is a bit too large.

Im sorry for my broken english.

Greetings :(

Pages: [1] 2