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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Leltoson

Pages: [1]
1
General / Re: Help with basic collisions
« on: May 08, 2016, 05:52:42 pm »
I did not end up using this in my game in the end, but I learnt a lot by trying either how. :D

2
General / Re: Help with basic collisions
« on: May 07, 2016, 03:17:48 am »
I got it working actually:

 if (player.getGlobalBounds().intersects(spaceship.getGlobalBounds()))
      {
         std::cout << "testing collision" << std::endl;
                        player.move(x=relative to spaceship speed?, 0);
      }

3
General / Re: Help with basic collisions
« on: May 06, 2016, 09:00:21 pm »
With intersects it did not work. With contains it did as so:

   if (player.getGlobalBounds().contains(spaceship.getPosition()))
      {
         std::cout << "testing collision" << std::endl;
                        player.move(x=relative to spaceship speed?, 0);
      }

I am now currently struggling with setting it so when the player is on top of the spaceship it is riding it at the same speed? It moves along with the already pre determined / automated / ai movement of the spaceship.

4
General / Help with basic collisions
« on: May 05, 2016, 09:29:21 pm »
What is the most basic form of writing an if statement to detect a collision?

I have two sprites and I basically want one sprite to be moved along by the other (The other sprite has predefined movement behaviour whilst the other sprite is moved by the arrow keys on the keyboard.

Imagine it like the player jumping onto the roof of an already moving spaceship.

Please let me know if you require any more information from me, I am happy to provide this for my space game.

Pages: [1]
anything