Creating a pong type game to played inside documents

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • I Hate My Computer
    New Member
    • Mar 2007
    • 44

    Creating a pong type game to played inside documents

    I need help with some VB code. Ultimately I would like it in VBA because that's all I have. I am making a fun game to hide in all of my docs. It is a pong like game but you need to have your pad deflect a ball that a alien drops. I also need help making the aliens move by themselves and drop the balls at a specific spot. Any help or ideas would be nice.This is my first post so go easy on me.

    Thanks
  • vijaydiwakar
    Contributor
    • Feb 2007
    • 579

    #2
    Originally posted by I Hate My Computer
    I need help with some VB code. Ultimately I would like it in VBA because that's all I have. I am making a fun game to hide in all of my docs. It is a pong like game but you need to have your pad deflect a ball that a alien drops. I also need help making the aliens move by themselves and drop the balls at a specific spot. Any help or ideas would be nice.This is my first post so go easy on me.

    Thanks
    see we r not getting u
    so if possible explain it in detail

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by I Hate My Computer
      I need help with some VB code. Ultimately I would like it in VBA because that's all I have. I am making a fun game to hide in all of my docs. It is a pong like game but you need to have your pad deflect a ball that a alien drops. I also need help making the aliens move by themselves and drop the balls at a specific spot. Any help or ideas would be nice.This is my first post so go easy on me.
      Sounds an interesting idea. I hope it works out.

      However, we generally expect people to work out what they want to do, and make some attempt at it. Then, when you have specific questions about points where you get stuck we can help with the how.

      What have you achieved so far on this project?

      Comment

      • vijaydiwakar
        Contributor
        • Feb 2007
        • 579

        #4
        Originally posted by I Hate My Computer
        Don't hate ur Computer
        :)

        Comment

        • I Hate My Computer
          New Member
          • Mar 2007
          • 44

          #5
          Originally posted by vijaydiwakar
          see we r not getting u
          so if possible explain it in detail
          I am using VBA to make a game. The first thing that I want is to make a picture of a spaceship that I have move around the window randomly. I know that I need a randomize script of some kind but I tried and it didn't work. Help is always great.

          Thanks

          Comment

          • vijaydiwakar
            Contributor
            • Feb 2007
            • 579

            #6
            Originally posted by I Hate My Computer
            I am using VBA to make a game. The first thing that I want is to make a picture of a spaceship that I have move around the window randomly. I know that I need a randomize script of some kind but I tried and it didn't work. Help is always great.

            Thanks
            for that u may use timmer ctrl with less interval or u may use system second part or u may use rnd function to do so
            try it
            Good Luck

            Comment

            • I Hate My Computer
              New Member
              • Mar 2007
              • 44

              #7
              Originally posted by Killer42
              Sounds an interesting idea. I hope it works out.

              However, we generally expect people to work out what they want to do, and make some attempt at it. Then, when you have specific questions about points where you get stuck we can help with the how.

              What have you achieved so far on this project?
              I have tried to make a randomize script but I need to make that do something to the ship. I need it random so people can't find all to possible combinations and beat it. I am trying to do this with at least 4 ships.

              Thanks

              Comment

              • I Hate My Computer
                New Member
                • Mar 2007
                • 44

                #8
                Originally posted by vijaydiwakar
                for that u may use timmer ctrl with less interval or u may use system second part or u may use rnd function to do so
                try it
                Good Luck
                My random number code looks like this:

                Private Function RandomNumber() As Integer
                Randomize Timer
                RandomNumber = Int(Rnd * 100)
                Label1 = RandomNumber
                End Function

                Private Sub CommandButton1_ Click()
                Call RandomNumber
                End Sub

                I push the button to make random numbers in the label1. But I need to make that move the picture.

                Thanks

                Comment

                • SammyB
                  Recognized Expert Contributor
                  • Mar 2007
                  • 807

                  #9
                  Originally posted by vijaydiwakar
                  Don't hate ur Computer
                  :)
                  I don't know about that. Computers, cars, and lawn mowers are not here to stay. I agree with Thomas Watson, past president of IBM, who allegedly said, "I think there is a world market for maybe five computers." :D

                  Comment

                  • I Hate My Computer
                    New Member
                    • Mar 2007
                    • 44

                    #10
                    Originally posted by SammyB
                    I don't know about that. Computers, cars, and lawn mowers are not here to stay. I agree with Thomas Watson, past president of IBM, who allegedly said, "I think there is a world market for maybe five computers." :D
                    Fine that is enough I don't hate my 2 new vista computers just my 5 old ones. Now that I got that over with lets stay on topic with the game that I want to program.

                    Thanks

                    Comment

                    • Killer42
                      Recognized Expert Expert
                      • Oct 2006
                      • 8429

                      #11
                      Originally posted by I Hate My Computer
                      ...I push the button to make random numbers in the label1. But I need to make that move the picture.
                      Not to sure about VBA, but in VB to move a picture you just use the .Move method of the PictureBox or ImageBox control, or set the .Top and/or .Left properties.

                      Comment

                      • I Hate My Computer
                        New Member
                        • Mar 2007
                        • 44

                        #12
                        Originally posted by Killer42
                        Not to sure about VBA, but in VB to move a picture you just use the .Move method of the PictureBox or ImageBox control, or set the .Top and/or .Left properties.
                        In VBA it is .Top and/or .Left but how can I make that random?

                        Thanks

                        Comment

                        • Killer42
                          Recognized Expert Expert
                          • Oct 2006
                          • 8429

                          #13
                          Originally posted by I Hate My Computer
                          In VBA it is .Top and/or .Left but how can I make that random?
                          Well, one way to move it at random would be to generate 2 random numbers, one for X coordinate and one for Y. Then you just add your random numbers to the .Top and .Left values.

                          There are better ways, of course. This tends to make them jiggle around like a mad thing.

                          What I like to do in such a case is initially establish a random value for the "speed" in each direction (horizontal/vertical). Then each move, you add that "speed" value to the current value. That way, the object moves in a random direction, but keep on moving that way until you change it.

                          Comment

                          • I Hate My Computer
                            New Member
                            • Mar 2007
                            • 44

                            #14
                            Originally posted by Killer42
                            Well, one way to move it at random would be to generate 2 random numbers, one for X coordinate and one for Y. Then you just add your random numbers to the .Top and .Left values.

                            There are better ways, of course. This tends to make them jiggle around like a mad thing.

                            What I like to do in such a case is initially establish a random value for the "speed" in each direction (horizontal/vertical). Then each move, you add that "speed" value to the current value. That way, the object moves in a random direction, but keep on moving that way until you change it.
                            That would be great. Could I do a thing where it it would bounce off the sides?

                            Thanks

                            Comment

                            • Killer42
                              Recognized Expert Expert
                              • Oct 2006
                              • 8429

                              #15
                              Originally posted by I Hate My Computer
                              That would be great. Could I do a thing where it it would bounce off the sides?
                              Sure, that's easy. You just check when you move it. If the horizontal position is < 0 or > form width, reverse the movement in that direction. Same for Y.

                              I'm just leaving work, but when I get home I'll see whether I have time to put together a simple demo that bounces around a window. It'll be in VB6, but should give you some ideas to play with.

                              Comment

                              Working...