Hey guys,
I am working on a 2D side scroller game. Where a ball is moving continuously towards right . I used a camera to follow the ball as soon as ball reaches the center of screen. I created a horizontal line to look like the surface on which the ball is rolling.
line runs from x=0 to x=800 (i.e screen width)
NOTE: (0,0) coordinate is at top left corner of display.
Problem: My display is 800 x 400 . Camera follows the ball, but soon the ball crosses x=800 and starts moving in black background. I want that line surface to stay there instead of going out of bound.
Actually, its not just about the line segment anymore. The value of x=800 is very crucial because i draw random obstacles (the enemy TRIANGLES) from that point. So if the ball passes that 800th pixel , generated obstacles from x=800 also move off the screen along with my line. So the ball wont be facing any obstacles (where is the fun in that?). We dont want that to happen.
I did a little digging on internet, but nothing wraps around my head.
What should be done here? This is just my first c++ game project using ALLEGRO 5.0.10, so i might be skipping things that can solve the issue.
Need expert inputs to tackle this problem.
Hope these screenshots manage to show, what the real problem is:
[img]
http://s22.postimg.org/erpdq7n3x/image.jpg[/img][/url]
[img]
http://s22.postimg.org/mbigs9gal/image.jpg[/img][/url]
[img]
http://s29.postimg.org/to2z1wh83/image.jpg[/img][/url]