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

Pages: [1]
1
General / Re: Ball in Pong only moves in 4 directions
« on: November 22, 2016, 07:53:58 pm »
I'm not incredibly mathematically inclined, so this is something that I kind of struggled with too.

The solution that I came up with is to compute an angle based on where the Ball strikes the paddle. The "angle of reflection" becomes much more severe as the Ball hits closer to one of the extreme ends (top or bottle of the Paddle). Similarly, the angle is less severe the closer to the center the ball strikes. This way, the player can bounce the Ball upwards if they position the paddle in a way that it hits towards the top; likewise for bouncing the Ball downwards.

It looks a little something like this:

The closer to the center/green the Ball hits, then a smaller angle is computed and the Ball's reflection angle isn't changed drastically.
The closer to the edges/orange-red the Ball hits, then a larger angle is computed and the reflection angle is much more extreme.

Mathematically, this is my approach:
  • Calculate the distance between the Ball's center and the center of the Paddle.
  • Compute the angle using cmath's sin() function, passing in the distance divided by the maximum desired angle. In my case, I used 50 as my maximum desired angle.

Hint: just following the math won't replicate the way I did it entirely. In order to do that, remember that SFML's Y axis is reversed from normal 2D coordinates that we do in math.

Hope this helps.

2
General / Re: Learning sfml and have a question
« on: November 19, 2016, 07:07:15 am »
Im currently learning SFML and im reading SFML Game Development and within the book it shows that i should run the game in a game class which has the methods
 public:
   Game();
   void Run();
   
private:
   void ProcessEvents();
   void Update();
   void Render();


now im also watching youtube tutorials and the tutorials are showing just having it all run in the main function,

which should i be doing?

thanks

It would be good practice (especially for bigger projects) to have your code placed in a Game class like that. Cleaner, more reusable code that is easier to debug is always preferable to a giant function somewhere. Breaking the code down into clean units = good practice, for all kinds of development not just game development.

3
SFML projects / Re: Nero Game Engine
« on: November 19, 2016, 07:03:25 am »
Looks like you've got a lot of work done on this! Looking good so far. Your GitHub link is broken though, did you move the repo somewhere?

4
SFML projects / Re: Crowdfunding for "Stardust" requested HELP!!!
« on: November 18, 2016, 07:33:29 pm »
It would be nice if you could tell us what the game is about, maybe its mechanics, etc. My Spanish isn't anywhere near where it used to be and I'm only getting fragments of what it's like from your website. All I got from this post is that you want 10,000 euros to make a game that you're using SFML for.

In lieu of financial support, you might have a better chance getting people who might want to collaborate with you from this site if you provide more detailed information on the game itself.

5
SFML projects / Re: Screenshot Thread
« on: November 17, 2016, 10:03:35 pm »
My Sokoban clone:
https://vid.me/PWcl

Looks good! The generating of the map from the text file looks like it translated over well (looking at what's up on the IDE). The inaccessible areas at the top and bottom that are just made of grass -- was that intentional or is it supposed to be segments of other rooms you can gain access to?

Also, for anyone who doesn't know what Sokoban is (like me)

6
SFML projects / Re:creation - a top down action adventure about undeads
« on: November 17, 2016, 04:46:37 pm »
I seem pretty late to the party but I just wanted to say that this project looks amazing and it's very inspiring.

7
SFML projects / Simple Paddle - a simpleton's attempt at Pong!
« on: November 16, 2016, 09:23:40 pm »
I wanted to start learning how to use SFML so I figured I might as well start small-ish. I made Simple Paddle! A Pong clone that deliberately doesn't use the word Pong.


The source code is available on Github!

It's nothing terribly special but it's mine and I wanted to share it with someone. Right now my main concern is that the way I handled collisions are pretty lazy because if the ball hits the very top/bottom of the paddle at the right angle it's possible for it to get stuck and wobble about. It's a fairly rare case in the times I've played. I also might end up programming an AI for it but I haven't really decided.

If you'd like to leave any feedback, I'd welcome it!

Thanks for stopping by.

Pages: [1]
anything