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

Pages: 1 ... 3 4 [5] 6
61
General / Problem with moving/turning a sprite in cursor direction
« on: November 30, 2011, 10:39:31 pm »
I don't understand this:
Code: [Select]
...+(45/PI)
Deg to Rad conversion should be something like:
Code: [Select]
(deg * PI) / 180
atan2 function returns the angle in radians, and you are adding some strange value to it. Maybe you have reasons to do it, but I can't deduce more from that piece of code.

Also, I suppose that the center of the sprite is on the middle of the image, so you could simply use this:
Code: [Select]
float dx = App->GetInput().GetMouseX() - playerPos.x;
   float dy =  App->GetInput().GetMouseY() - playerPos.y;


Hope it'll be helpful, if not, do the code more specific.
Nice idea showing a video ;)

62
C / Any easy physics engine you can recommend me?
« on: November 30, 2011, 09:28:46 pm »
Yes, it is :)

I saw there is an engine called Havok, used by proffesional games. I think that it's free for non-comercial games.

63
C / Any easy physics engine you can recommend me?
« on: November 29, 2011, 09:53:56 pm »
For a simple physics engine you can build your own one, it's not difficult. Although, you can use ODE or Box2D. The last one just easier, but it's implemented in C++.

64
Graphics / animation movies
« on: November 28, 2011, 12:20:45 pm »
Maybe you are looking for something like Scratch

I've never used it, but some universities are thinking on teaching the basics and they are trying to get expert people in this area.

It seems to be easy and children oriented.

65
General / Trapping function keys
« on: November 25, 2011, 05:05:09 pm »
Yes, you're right, something goes wrong when typing those keys fast. I don't know what's going on.

66
General / Sprite movement
« on: November 13, 2011, 11:44:38 pm »
In SFML2.0 is just easier.
Code: [Select]

sf::Keyboard::IsKeyPressed(sf::Key::Right);

There are sf::Keyboard and sf::Mouse for this purpose. Get a look to the doc.

67
Graphics / Help with logic behind displaying game map?
« on: November 12, 2011, 10:04:02 pm »
You have a good ResourceManager implementation on the Wiki that you can use for images and other resources. This way you'll load images only once.

69
SFML projects / TileCat Map Editor
« on: November 12, 2011, 01:40:06 am »
Quote from: "s1ay3r44"
Well, more or less for the experience of coding it. Also I can change it easily to suit my needs.

Also I'd like to expand it and make it unique eventually.

I agree!! I also try to make my own tools when making a game. And I think that each game should have its respective map maker.

For example now I am making my own physics engine, there are free engines such as ODE, Box2D... But it's a really good experience making your own one.

Cheers.

70
General / [SOLVED]Strange error with graphics-window.cpp
« on: November 10, 2011, 06:19:54 pm »
Check the project properties and look at the "working dir" field. You can change it, and all resources should be in that folder.

71
Graphics / Re: How does the Draw() work?
« on: November 10, 2011, 12:41:21 am »
Quote from: "shiroaisu"
And also, if i have a sprite that is offscreen and i call Draw() on it will the Draw() try to draw the sprite or will it recognize that the sprite is not inside the window and skip the drawing process??
Should i then use x and y checks before i try to draw something to see if it actualy is on screen to avoid any unnecessary processing?

I think it does it automatically. In fact, I proved and FPS gets down when sprites are out of view.

72
General / [SOLVED]Strange error with graphics-window.cpp
« on: November 10, 2011, 12:35:02 am »
Try to clean the project and build it all again

73
General / Program can't start because sfml-system.dll is missing
« on: November 08, 2011, 11:53:51 pm »
DLL files must be in the same directory of executable or in the system folder of windows

74
Graphics / Sprite collection implementation?
« on: October 29, 2011, 12:52:43 pm »
Quote from: "fatum"

Yup, that's actually what I used to do.  I check if there are objects outside of my CameraView rectangle, and if they are, don't draw them.  I think I've noticed a slight performance increase, I suppose it doesn't take long to loop through the for loop, only drawing and updating the objects requires more time.

Thanks!


Anyway, I think SFML does it automatically, so you shouldn't worry if you try to draw something outside the view.

For the collision checking, implementing BSP trees doesn't become easy and one of the best solutions in 2D games usually is to partition the world space with a grid.



You can implement this using arrays or a hash table. To get the grid cell where you are, you can divide your player's position (x, y) by grid size. This way you ONLY check collisions between objects in that cell.

Something like this in pseudo-code, note that you have to do an int conversion:
Code: [Select]
gridX = obj.x / gridSize.x
gridY = obj.y / gridSize.y


Good luck!

75
Graphics / Sprite collection implementation?
« on: October 27, 2011, 11:36:14 pm »
You could create a new custom class containing a SFML sprite and one rectangle. And update both of them at the same time, even better, you can update the rectangle using sprite class methods for getting coords.

For checking to exclude some blocks from the vector, you could calculate the distance to your player, or check if they are inside the view. But, anyway you have to check ALL blocks.

But if you do a collision check against every block in your world, you'll get a slow program. So you need to priorize and partition the world space. Use an orthogonal 2D grid or BSP trees. (http://en.wikipedia.org/wiki/Binary_space_partitioning)

Now I haven't time, but maybe I'll do a little example later.

Let your imagination fly..

Pages: 1 ... 3 4 [5] 6
anything