Announcement

Collapse
No announcement yet.

Mouse Throwing

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Mouse Throwing

    Hello, I've been trying to make an object throwing system like in Pokemon Go, but I can't figure out how. This is what i have so far:

    Click image for larger version

Name:	code.jpg
Views:	1
Size:	65.2 KB
ID:	1200278

    I think I need to calculate the screen position aswell but I can't figure out how to get the correct location. Does anyone have any ideas about this? This is what the game looks like at the moment(I started it yesterday, no actual graphics yet):

    Click image for larger version

Name:	game.jpg
Views:	1
Size:	47.4 KB
ID:	1200279

    #2
    Originally posted by DjSt3rios View Post
    Hello, I've been trying to make an object throwing system like in Pokemon Go, but I can't figure out how. This is what i have so far:

    [ATTACH=CONFIG]117151[/ATTACH]

    I think I need to calculate the screen position aswell but I can't figure out how to get the correct location. Does anyone have any ideas about this? This is what the game looks like at the moment(I started it yesterday, no actual graphics yet):

    [ATTACH=CONFIG]117152[/ATTACH]
    Imo save vectors in tick and on mouse release compare last 2 vectors... like when first frame is vector 0 0 0 and second is 1 2 5 then subreact and multiply that values by something and launch ball... im really not sure if this can work but its a shot

    Comment


      #3
      Originally posted by Name368 View Post
      Imo save vectors in tick and on mouse release compare last 2 vectors... like when first frame is vector 0 0 0 and second is 1 2 5 then subreact and multiply that values by something and launch ball... im really not sure if this can work but its a shot
      Thanks for the reply! I thought about that but the problem is I want the player to use some "Force" while throwing it. If I do it this way you can slowly push it forward and release it 20 seconds later and the ball will still move forward with a lot of force.

      Comment


        #4
        Originally posted by DjSt3rios View Post
        Thanks for the reply! I thought about that but the problem is I want the player to use some "Force" while throwing it. If I do it this way you can slowly push it forward and release it 20 seconds later and the ball will still move forward with a lot of force.
        No no because you compare only last 2 vectors time wont affect force... only position between last 2 frames
        Another thing is that you can truly make only "2d" vector with mouse... x and y... z must be calculated based on x and y between last 2 vectors somehow...

        Comment


          #5
          Originally posted by Name368 View Post
          No no because you compare only last 2 vectors time wont affect force... only position between last 2 frames
          Another thing is that you can truly make only "2d" vector with mouse... x and y... z must be calculated based on x and y between last 2 vectors somehow...
          I see what you mean. Could work, but right now the main problem is I can't make the ball to follow the exact location of the mouse

          Comment

          Working...
          X