SFML community forums
General => SFML projects => Topic started by: Mortal on January 14, 2016, 10:27:56 pm
-
i have made simple puzzle game, it is quite simple and easy, i have done it before but in win32 console. when i start learning C++,
GamePlay:
the game is simple has only one button "scramble" it does shuffle the numbers and start from beginning, and user may use arrow keys to move in the only space available in the game. i didn't add time limit. it's a bit harder by itself.
finially i'm able to complete the puzzle. here a demo of game play
http://www.youtube.com/watch?v=qArw1fOMP04
-
This game is easy :P
Does your scramble place the number in a random order or does it move them randomly multiple times to shuffle/scramble them?
If they're in a random order, 50% of the time, the puzzle is unsolvable :-X
p.s. I meant that the game is easy to play and win; it's not a comment on the creation of the program!
-
This game is easy :P
nah, i couldn't finish it, i just moving number peaces around, like a dumb guy who dont know what he doing. lol, i'm sure there are some rolls need to apply in order to complete it.
Does your scramble place the number in a random order or does it move them randomly multiple times to shuffle/scramble them?
If they're in a random order, 50% of the time, the puzzle is unsolvable :-X
yeah, scramble is tricky part i did both, i had to create indices array to shuffle it and place tile peaces in random order based on indices values.
p.s. I meant that the game is easy to play and win; it's not a comment on the creation of the program!
thanks for complement, actually it is indeed easy to make but harder to complete :)
-
Update
since there is only one free place that tile peaces can fit in i added mouse click for easing the game control, the user can move tile speaces either with arrow keys or by mouse click
-
Most reliable way to scramble would to just move in a random direction many times.
Does your clicking require one tile at a time to move or can you click multiple tiles away? e.g. In your image, can you click "11" to move them both or do you need to click "7" first and then "11"?
-
Most reliable way to scramble would to just move in a random direction many times.
good point, yeah that only what it needs to shuffle the tile peaces instead of Reconstruction the whole tiles again. i have edit repo.
thanks alot Hapax :)
Does your clicking require one tile at a time to move or can you click multiple tiles away? e.g. In your image, can you click "11" to move them both or do you need to click "7" first and then "11"?
it moves only one tile for each mouse click. i believe multiple movements can be done by mouse clicked but how this will applied to arrow keys, i mean, how to select group of tiles by arrow keys?
-
You don't need to add this functionality to key controls as you can easily press the key multiple times. Clicking on a tile that is multiple tiles away from the hole/space, though, gives the impression that they are trying to move that specific tile.
If you want to include a way to "slide" multiple tiles with the keys (choose either two tiles or the rest of the row to the end), you could do that if shift is pressed when you press the arrow key. This is optional, of course, and totally up to you if you want this sort of thing ;D
-
If you want to include a way to "slide" multiple tiles with the keys (choose either two tiles or the rest of the row to the end), you could do that if shift is pressed when you press the arrow key. This is optional, of course, and totally up to you if you want this sort of thing ;D
i guess you already know my answer. lol
i have no idea how to implement it, but it is really worth to try.
-
Update
- fixed bug where some tiles not shuffle properly
- effectively generate randomness
- mimic std::shuffle's functionality, now tiles shuffled correctly
i'm so excited of being able to finish a game in two days, :) , that a world record for me. gotta celebrate to night
cheers
-
It's pretty cool that you make so much stuff in such short amount of time. Great job :)
-
It's pretty cool that you make so much stuff in such short amount of time. Great job :)
thanks Elias, i appreciate so much
-
Good to see a video up of it in action! Also good to see that you won the game! (told you it was easy :P )
I still think you should implement moving multiple tiles with the mouse ::)
-
Good to see a video up of it in action! Also good to see that you won the game! (told you it was easy :P )
thanks Hapax, yeah you are right, but it become easy only after i learned from 11 years boy on youtube about how to play it. ;D
I still think you should implement moving multiple tiles with the mouse ::)
i have implemented after struggle about array indexes and swapping them. it seems okay, hopefully it is free of hidden bugs :-\
here a Demo:
(http://i.imgur.com/GXNSrTR.gif)
-
If you wanted a simple way to implement it (performance on this sort of game would not be affected), you could simply get the tile clicked on and then:
1) work out if it's on the same horizontal or vertical line as the space,
2) calculate how many spaces away from the space, and
3) loop moving one space in the correct direction.
I'm glad you added it, though. It makes a big difference to the playability with the mouse!
-
If you wanted a simple way to implement it (performance on this sort of game would not be affected), you could simply get the tile clicked on and then:
1) work out if it's on the same horizontal or vertical line as the space,
2) calculate how many spaces away from the space, and
3) loop moving one space in the correct direction.
i wished i had your comment earlier, it would save me time that i spent it on how to move tile peaces efficiently. coincidentally i just did this mechanism in the game
I'm glad you added it, though. It makes a big difference to the playability with the mouse!
thanks, i'm totally agree with that