Jump to content

  • Log In with Google      Sign In   
  • Create Account


Spawn point and check point SFML


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Vidar son of Odin   Members   -  Reputation: 1320

Like
0Likes
Like

Posted 05 February 2014 - 07:51 AM

Hello everyone,

 

I am making a maze game and I got some problems with spawn point of my player sprite. The player will control the sprite through the maze using the mouse. The problem is that I want my player to start from a point not to start from where player clicked play button. I don't know if I can explain it that you guys can understand... rolleyes.gif I will add images.

 

Here is my main menu.

main menu.PNG

 

When play is clicked, game starts, and because my sprite will be rendered at mouse position, sprite will move at last mouse coords.

This is the problem. I want the player to start from the down-right corner not from middle of the screen..

start 1.PNG

 

Notes:

 


Check out my portfolio : https://bratie.wordpress.com

"Don't gain the world and lose your soul. Wisdom is better than silver or gold." - Bob Marley

 


Sponsor:

#2 Eck   Members   -  Reputation: 1713

Like
3Likes
Like

Posted 05 February 2014 - 08:23 AM

When processing your "Play" click, you'll want to set the position of the mouse cursor to your spawn point. A quick google search led me to this post about how to do that in SFML:

 

http://stackoverflow.com/questions/7860034/how-can-i-change-the-position-of-the-mouse-cursor-in-opengl-sfml

 

Good luck!

- Eck



#3 Vidar son of Odin   Members   -  Reputation: 1320

Like
1Likes
Like

Posted 05 February 2014 - 09:42 AM

When processing your "Play" click, you'll want to set the position of the mouse cursor to your spawn point. A quick google search led me to this post about how to do that in SFML:

 

http://stackoverflow.com/questions/7860034/how-can-i-change-the-position-of-the-mouse-cursor-in-opengl-sfml

 

Good luck!

- Eck

Thank you very much! I searched on google before but didn't returned me any useful results.


Check out my portfolio : https://bratie.wordpress.com

"Don't gain the world and lose your soul. Wisdom is better than silver or gold." - Bob Marley

 


#4 LordRhys   Members   -  Reputation: 343

Like
2Likes
Like

Posted 07 February 2014 - 07:51 AM

other thing you may want to look into is State machines, you really should have that start menu screen in a different state from your actual play screen this way the click on the Play button has no effect on your play screen and you player sprite will spawn in where you specified.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS