Currently, I'm re-making a NES game called Fire 'N' Ice.
Here are some of the game's machanism:
1. The game's actors are wall (as block or ground) and ice block
2. Player only can create ice block at their bottom-right diagonal or bottom-left diagonal (by pressing D)
(the player cannot jump, and can only create ice when they stand on something (in this game, the player can stand on either ice block or block), so it is guaranteed that when player create an ice block, there's already a wall or another ice block beside the created ice block
If there's any block or ice block under the player, the ice block will stick to it and can't fall
3. If there's an obstacle (wall) at player's bottom-right / bottom-left diagonal, and the player press D, the ice cannot be created
4. If there's an ice block at player's bottom-right / bottom-left diagonal, and the player press D, the ice in that place will disappear (player can re-create and remove ice block at the same place without limit)
5. Once the player pushes ice block, the ice block won't stop unless it hits another ice block or wall or fall
6. Player can only push one ice block at a time. If there's a space beside the ice block
7. If there's not space beside the ice block and no other object on the iceblock, the player will climb it
8.After player create the ice block, and it's beside the wall, then ice block will stick to it. But if player move onto the created ice block, and create another ice block beside it, then it will merge (it becomes a long ice block). As long as one of the ends of the long ice block stick to a wall it won't fall
Here are the game's mechanism that I'm still trying to solve
1. After player create the ice block, and it's beside the wall, then ice block will stick to it. But if player move onto the created ice block, and create another ice block beside it, then it will merge (it becomes a long ice block). As long as one of the ends of the long ice block stick to a wall it won't fall
Note: in my greenfoot, instead of making a new actor for merged iceblock, i use a code so it won't fall as iceblock won't fall if it's summoned beside another iceblock, it will fall if it lose its grip on both ends of the long ice block
Here's my code for it:
This code is in IceBlock class
If I use the code above, the result:
1. When I create ice block on my left wall, it will stick (success)
2. When I create another ice block beside the created ice block, it will stick to each other (success)
3. When I'm on the right side of the map and remove an ice block, the long iceblock on the left side falls (success)
4. Even if the long iceblock falls, it won fall entirely, some iceblock will stuck (failure)
5. After I create the long ice block to the other side of the wall (it's supposed to stick), I'm on the left side of the map and remove an ice block, all iceblock falls (failure)
I'm really sorry for my bad English, and it's really hard to explain the game's rules in words.
Here's the link for the gameplay
I'm terribly sorry for the inconvenience

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | public void act() { if (!(onIce())) { if (!(squeezed())) { checkFall(); } } } public boolean squeezed() { if (!(onGround())) { Actor ice = getOneObjectAtOffset( 32 , 0 , Blocks. class ); Actor wall2 = getOneObjectAtOffset( 32 , 0 , Wall. class ); if (ice== null && wall2== null ) { return false ; } else { return true ; } } if (!(onGround())) { Actor wall = getOneObjectAtOffset(- 32 , 0 , Wall. class ); Actor ice2 = getOneObjectAtOffset(- 32 , 0 , Blocks. class ); if (wall== null && ice2== null ) { return false ; } else { return true ; } } return true ; } |


