Greetings dear friends,
It's a great privilege to join this week's task on this course titled Programming Games & Puzzles which is organised by @sergeyk. After going through the lecture and the assignment task, it came to my notice that I will need to develope a game and will do that from one process to the other through the questions given.
I'm using online Python IDE for this task. So let's go ahead with the game process based on the questions given on the task.
edges Make the field longer, put ( в init()) on the edges, for example, of a pillar - #at a random distance of 0-2 from the edges of the map (field). The player must move between these pillars. |
---|
Based on this question, I'm to create a game that has a field and these fields will have pillars which will be placed near the edges of the field and it is also expected to have a random distance of about 0-2 units from the edge of the map and the players will be moving between the pillars.
To begin, the following must be taken into consideration. Field dimensions, pillar placement and the player movement.
From the question the field dimensions was not given hence I decided to use a dimension of (10,10) for the width and height respectively.
In the case of the pillars I will generate their position randomly as requested by the question and also ensure that all pillars are within the edges also I'm not forgeting to ensure that they are 0-2 units aware from the edges of the map.
In the case of the player movements, players will be moving within the pillars and these pillars and the field boundaries are restriction so that players don't move out of the field. Lets consider a code example for that below.
From the gif image above, you can see the code and the result produced. Pillars represented with (P) are placed randomly either at the top, bottom, left or right of the edges of the field from the result display and all the pillars are within the field dimensions.
puddles Complete the first task, make the field even longer, randomly place puddles on the field _. The player has to pass through these puddles without obstacles, only to change his appearance to %a wet player. |
---|
To add to the game, this question introduce to us puddles on the field and also an extension of the field. So what happens here is that I increased the dimensions of the field to (20,15) for its width and height respectively. Also I added a feature to tell if the player is wet or dry.
This means that if the player passes through puddles, it should print wet but if it didn't pass through puddles it should print dry. So the initial game has just this few changes. Lets consider a code example for that below.
From the gif image above, you can see the code and the result produced. Pillars represented with (P) are placed randomly either at the top, bottom, left or right of the edges of the field, puddles are represented with (~) and players are represented with (X).
jump Add a jump (spacebar) - the player jumps one cell in the direction of his movement!!! |
---|
Based on what we have already in the game, a jump functionalities via the spacebar is to be introduced here in this question. Now, recall the the players moves either right, left, up or down. Which ever direction they are going, it is expected that the jump functionalities helps them to jump a puddles in a specified direction of movement.
With the jump functionalities I feel that the size of the field should also increase hence I have added the width and height of the field to (30,15) respectively. Lets consider a code example for that below.
From the gif image above, you can see the code and the result produced. Pillars represented with (P) are placed randomly either at the top, bottom, left or right of the edges of the field, puddles are represented with (~) and players are represented with (X) and jump is gotten when the spacebar is pressed anytime the player is moving.
Recall that the result shows wet when the player moves through puddles and dry when it moves through regular cells. To play this game, the up, down, left and right arrow can be used to move the players and the spacebar is used to enable player jump.
puddle disappears If the player jumps (through the space) into a single puddle - it dries up, when the player simply runs through the puddle - it does not dry up. |
---|
Another feature to be added to our already existed game which is running. When the player runs through the puddles he gets wet and then we see the puddles still there but when the player jumps through the puddles, it disappears meaning the puddles dries up. So just as already implemented we are going to add the puddle drying option. Lets consider a code example for that below.
From the gif image above, you can see the code and the result produced. Pillars represented with (P) are placed randomly either at the top, bottom, left or right of the edges of the field, puddles are represented with (~) and players are represented with (X) and jump is gotten when the spacebar is pressed anytime the player is moving, i.e, if jump=true and when jump=false (running).
When there is jump, the puddle disappear and player becomes dry but if no jump and player runs puddles remain and player becomes wet.
stones Complete the first task, make the field even longer, randomly place stones on the field a. The player cannot cross these stones, but must cross these stones. |
---|
Another feature has been introduced in this stage of the game where an obstacle called stone is put in place randomly and players can not cross the stones because it serves as a barrier to them. So players must look carefully to see so that they don't land on stone. The stones are immovable and can not be jumped over like the case of the puddles. Seeing that my field is still large enough I maintained the initial size of width and height of the field to (30,15) respectively. Lets consider a code example for that below.
From the gif image above, you can see the code and the result produced. Pillars represented with (P) are placed randomly either at the top, bottom, left or right of the edges of the field, puddles are represented with (~) and players are represented with (X) and jump is gotten when the spacebar is pressed anytime the player is moving, stones are represented with (S).
statistics Add statistics: - number of moves, jumps, puddles, stones. |
---|
To keep track or record of activities that the players passes through such as the number of moves, jumps, puddles and stones encounter then we still need to modify the code a bit and add the stats function. Let's consider a code example for that below.
From the gif image above, you can see the code and the result produced. The statistics of the number of moves, jumps, puddles crossed and stones blocked are seen below the execution after each movement of the player.
push A player can push one stone, no more. |
---|
A player is now allowed to push a stone just once during the game. So this means that if you push a stone during the game once you can't push again. Now we can add this feature to modify the game we have built initially. Let's consider a code example for that below.
From the gif image above, you can see the code and the result produced. The statistics of the number of moves, jumps, puddles crossed, stones blocked and pushes are seen below the execution after each movement of the player. So you can push a stone once in the direction of your movement via the arrow keys.
So that is the end of the game based on the lay-down questions given. I want to finally invite a few friends of mine to also join this contest if they haven't entered it yet. I invite @josepha, @dove11 and @solaymann.
This is not what you need at all, the problem is not solved at all. The process of the game should have been demonstrated in gifs, but you only show the code and static output. It looks like the solution of an AI that did not read my article, but only the problem. Everything is very similar to the post from jozepha
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Well, I went through your lesson and also try solving the issue you gave based on my understanding. The function for the player movement didn't work for me while using the keyboard so I thought you will guide me as to how I can achieve that. It's a beautiful thing I attempted it as I have learnt a few things from it. Thanks for your observations and suggestions I will try again in next time.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Upvoted! Thank you for supporting witness @jswit.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit