Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Game devs come out

Game devs come out

Scheduled Pinned Locked Moved The Lounge
questiongame-devhelp
8 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    ISIS55
    wrote on last edited by
    #1

    As I go along developing CPool, there's still one problem unanswered. Here goes: The balls don't slide on the table, they spin across it (like car wheels). Calculating it wasn't too difficult, but the main problem is displaying it graphically. In a 3D game, you would model a ball object and display it from different angles. Being a 2D game, I find it difficult to show the ball from different angles without making loads of sprites. How do I make it seem realistic, so the ball would actually spin and not slide? Making a few sprites won't be very useful since the balls can spin on more than one axis. Anyone has a solution? Isaac Sasson, Lean, mean posting machine! Sonork ID 100.13704

    I N R P D 5 Replies Last reply
    0
    • I ISIS55

      As I go along developing CPool, there's still one problem unanswered. Here goes: The balls don't slide on the table, they spin across it (like car wheels). Calculating it wasn't too difficult, but the main problem is displaying it graphically. In a 3D game, you would model a ball object and display it from different angles. Being a 2D game, I find it difficult to show the ball from different angles without making loads of sprites. How do I make it seem realistic, so the ball would actually spin and not slide? Making a few sprites won't be very useful since the balls can spin on more than one axis. Anyone has a solution? Isaac Sasson, Lean, mean posting machine! Sonork ID 100.13704

      I Offline
      I Offline
      ISIS55
      wrote on last edited by
      #2

      I just had some idea, but I'm not sure on how to go about it. I could draw a bitmap of the ball surface spread (like a flat world map) and then display portions of it on the ball as it spins. It would be hard to implement though, because of the curves and perspective. Isaac Sasson, Lean, mean posting machine! Sonork ID 100.13704

      T 1 Reply Last reply
      0
      • I ISIS55

        I just had some idea, but I'm not sure on how to go about it. I could draw a bitmap of the ball surface spread (like a flat world map) and then display portions of it on the ball as it spins. It would be hard to implement though, because of the curves and perspective. Isaac Sasson, Lean, mean posting machine! Sonork ID 100.13704

        T Offline
        T Offline
        Todd Smith
        wrote on last edited by
        #3

        Or you get down and dirty and create your own scanline ball renderer. It wouldn't be that hard. Todd Smith

        1 Reply Last reply
        0
        • I ISIS55

          As I go along developing CPool, there's still one problem unanswered. Here goes: The balls don't slide on the table, they spin across it (like car wheels). Calculating it wasn't too difficult, but the main problem is displaying it graphically. In a 3D game, you would model a ball object and display it from different angles. Being a 2D game, I find it difficult to show the ball from different angles without making loads of sprites. How do I make it seem realistic, so the ball would actually spin and not slide? Making a few sprites won't be very useful since the balls can spin on more than one axis. Anyone has a solution? Isaac Sasson, Lean, mean posting machine! Sonork ID 100.13704

          N Offline
          N Offline
          Nick Parker
          wrote on last edited by
          #4

          Ok, I think I have your answer for you, at least if you are interested in doing any of this in C# :confused: Christian Graus (our local C# buddy) has written several article that I think should help you out in this subject. Maybe you can take a look at what he has done and adapt it to what you need. Here are the links below, of course all in [New Windows] Collision - A C# Game, part 1: parallax scrolling Collision - A C# Game, part 2: tracking game elements and adding interaction Collision - A C# Game, part 3: pixel perfect collision detection HTH Nick Parker

          1 Reply Last reply
          0
          • I ISIS55

            As I go along developing CPool, there's still one problem unanswered. Here goes: The balls don't slide on the table, they spin across it (like car wheels). Calculating it wasn't too difficult, but the main problem is displaying it graphically. In a 3D game, you would model a ball object and display it from different angles. Being a 2D game, I find it difficult to show the ball from different angles without making loads of sprites. How do I make it seem realistic, so the ball would actually spin and not slide? Making a few sprites won't be very useful since the balls can spin on more than one axis. Anyone has a solution? Isaac Sasson, Lean, mean posting machine! Sonork ID 100.13704

            R Offline
            R Offline
            Robin
            wrote on last edited by
            #5

            Doing it in 3D would be so much easier. If you must force pain on yourself, you can use sprites but you need to be able to rotate them on runtime. It basicallys becomes 2D image manipulation calls. Whether the speed can be realtime then is questionable.

            1 Reply Last reply
            0
            • I ISIS55

              As I go along developing CPool, there's still one problem unanswered. Here goes: The balls don't slide on the table, they spin across it (like car wheels). Calculating it wasn't too difficult, but the main problem is displaying it graphically. In a 3D game, you would model a ball object and display it from different angles. Being a 2D game, I find it difficult to show the ball from different angles without making loads of sprites. How do I make it seem realistic, so the ball would actually spin and not slide? Making a few sprites won't be very useful since the balls can spin on more than one axis. Anyone has a solution? Isaac Sasson, Lean, mean posting machine! Sonork ID 100.13704

              P Offline
              P Offline
              Paul M Watt
              wrote on last edited by
              #6

              Create one set of sprite animations for the ball rolling, and I would say create the animations so the ball was rolling along the positive X axis, or 0 degreess. Then when a ball is to be rolled across the table, determine the angle that it is to be rolled at then create a temporary buffer for all of the ball animation sprites, and rotate all of the images by the angle of the direction that the ball is going to roll. So for example, if the ball is going to roll at an angle of 100 degrees from teh origin, create temporary sprites that have been rotated by 100 degrees, and the ball should look like it is rolling in that direction. the drawbacks of this technique is that you will not get the appearance of spin on the ball. But it should be a very simple trick. Just make sure that your rotation algorithm accesses the bits in the bitmap directly instead of Get and SetPixel. Good Luck!


              Build a man a fire, and he will be warm for a day
              Light a man on fire, and he will be warm for the rest of his life!

              I 1 Reply Last reply
              0
              • I ISIS55

                As I go along developing CPool, there's still one problem unanswered. Here goes: The balls don't slide on the table, they spin across it (like car wheels). Calculating it wasn't too difficult, but the main problem is displaying it graphically. In a 3D game, you would model a ball object and display it from different angles. Being a 2D game, I find it difficult to show the ball from different angles without making loads of sprites. How do I make it seem realistic, so the ball would actually spin and not slide? Making a few sprites won't be very useful since the balls can spin on more than one axis. Anyone has a solution? Isaac Sasson, Lean, mean posting machine! Sonork ID 100.13704

                D Offline
                D Offline
                David Wulff
                wrote on last edited by
                #7

                Isaac Sasson wrote: My balls don't slide on the table, they spin across it (like car wheels). I know - it's such a pain in the arse when that happens. No really. :rolleyes: ____________________ David Wulff I'll have a slow comfortable screw against the wall followed up with sex on the beach and a screaming orgasm on the rocks, please. Oh, and make all that with a black russian will you. Dave's Code Project Screensaver and Wallpaper page. Talk to me.

                1 Reply Last reply
                0
                • P Paul M Watt

                  Create one set of sprite animations for the ball rolling, and I would say create the animations so the ball was rolling along the positive X axis, or 0 degreess. Then when a ball is to be rolled across the table, determine the angle that it is to be rolled at then create a temporary buffer for all of the ball animation sprites, and rotate all of the images by the angle of the direction that the ball is going to roll. So for example, if the ball is going to roll at an angle of 100 degrees from teh origin, create temporary sprites that have been rotated by 100 degrees, and the ball should look like it is rolling in that direction. the drawbacks of this technique is that you will not get the appearance of spin on the ball. But it should be a very simple trick. Just make sure that your rotation algorithm accesses the bits in the bitmap directly instead of Get and SetPixel. Good Luck!


                  Build a man a fire, and he will be warm for a day
                  Light a man on fire, and he will be warm for the rest of his life!

                  I Offline
                  I Offline
                  ISIS55
                  wrote on last edited by
                  #8

                  Good idea. I thought of making a grid of sprites, when on each row/line the ball makes one spin. Then changing the sprites across would simulate the spin. Your way is very similar, smaller on size but harder on the CPU. I'll have to try both and see which is most optimal. Thanks ;) Isaac Sasson, Lean, mean posting machine! Sonork ID 100.13704

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups