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

Author Topic: SFML - Collision Demo  (Read 3934 times)

0 Members and 1 Guest are viewing this topic.

Demian

  • Newbie
  • *
  • Posts: 16
    • View Profile
SFML - Collision Demo
« on: May 08, 2010, 03:13:37 pm »
Hi : D

I started to play around with the collision and to benefit the most from it
I decided to begin a new project and post it here.
The finished program should help beginners to start with collision in 2D.
(I'm thinking about supporting this with some pictures oder pdf's)

My program has two features so far :
    -You can switch between collision or noclip
    -You can activate gravity
( I know there isn't  much of code in there yet, but consider that it should help beginners to understand collision.)

As shown down on the picture you see there are two blocks or rectangles.
The white block has a constant position and it can't be changed in no way(later it will be, because I want the collision to be able to operate with circles, triangle and etc)
The red, transparent, block is controlled by you.
(Later it should be possible to change it's form either)
You can change it's properties such as size and position, like I said a option for the form is going to be build later.
The collision feature keeps you from entering the white block.
You can't enter it from any side.
But, if I activate the gravity and disable it before I reach the ground( or the top line of the white block), the collision for the upper and lower side of the white block doesn't work, at all.
I can't figure out why, though the left and right side of the white block can't be entered furthermore.


Here is the project with all files.(documented and excuse me for not using classes and using globals, I will clean up the code later : D)
http://ul.to/9syuf7

Thank you and of course Laurent , too  ; D

EDIT :
Here you can find the picture to the demo.


Hugo

  • Jr. Member
  • **
  • Posts: 60
    • View Profile
Looks
« Reply #1 on: July 09, 2010, 12:07:32 am »
Looks good, I'll try it out and maybe offer suggestions, or features for helping beginners

 

anything