收藏小游戏功能,吴恒佚同窗又提出了一个跨世纪的回答
app
CanMoveToLeft(可否左移动)、CanMoveToRight(可否右移动)
构建的方法:2个依据,根据方块的x方位与本体所占的格之和是否与最大(最小)x轴重合或者已有方块重合spa
public static boolean canMoveToLeft(List<BlockUnit> blockUnits, int max_x, List<BlockUnit> allBlockUnits) { for (BlockUnit blockUnit : blockUnits) { int x = blockUnit.x; if (x - UNIT_SIZE < BEGIN) { return false; } int y = blockUnit.y; if (isSameUnit(x - UNIT_SIZE, y, allBlockUnits)) { return false; } } return true; }
public static boolean canMoveToRight(List<BlockUnit> blockUnits, int max_x, List<BlockUnit> allBlockUnits) { for (BlockUnit blockUnit : blockUnits) { int x = blockUnit.x; if (x + UNIT_SIZE > max_x - UNIT_SIZE) { return false; } int y = blockUnit.y; if (isSameUnit(x + UNIT_SIZE, y, allBlockUnits)) { return false; } } return true; }
public static boolean canMoveToDown(List<BlockUnit> blockUnits, int max_y, List<BlockUnit> allBlockUnits) { for (BlockUnit blockUnit : blockUnits) { int x = blockUnit.x; int y = blockUnit.y + UNIT_SIZE * 2; if (y > max_y - UNIT_SIZE) { return false; } if (isSameUnit(x, y, allBlockUnits)) { return false; } } return true; }
以上方法均为循环(知识点:列表)设计
public static boolean canRoute(List<BlockUnit> blockUnits, List<BlockUnit> allBlockUnits) { for (BlockUnit blockUnit : blockUnits) { if (isSameUnit(blockUnit.x, blockUnit.y, allBlockUnits)) { return false; } } return true; }
public static boolean canContinueGame(List<BlockUnit> allBlockUnits) { if (allBlockUnits.size() == 0) { return true; } for (BlockUnit blockUnit : allBlockUnits) { if (blockUnit.y <= BlockUnit.BEGIN) { return false; } } return true; }
public static boolean toLeft(List<BlockUnit> blockUnits, int max_x, List<BlockUnit> allBlockUnits) { if (canMoveToLeft(blockUnits, max_x, allBlockUnits)) { for (BlockUnit blockUnit : blockUnits) { blockUnit.x = blockUnit.x - UNIT_SIZE; } return true; } return false; }
public static boolean toRight(List<BlockUnit> blockUnits, int max_x, List<BlockUnit> allBlockUnits) { if (canMoveToRight(blockUnits, max_x, allBlockUnits)) { for (BlockUnit blockUnit : blockUnits) { blockUnit.x = blockUnit.x + UNIT_SIZE; } return true; } return false; }
public static void toDown(List<BlockUnit> blockUnits, int max_Y, List<BlockUnit> allBlockUnits) { for (BlockUnit blockUnit : blockUnits) { blockUnit.y = blockUnit.y + BlockUnit.UNIT_SIZE; } }
public static boolean isSameUnit(int x, int y, List<BlockUnit> allBlockUnits) { for (BlockUnit blockUnit : allBlockUnits) { if (Math.abs(x - blockUnit.x) < UNIT_SIZE && Math.abs(y - blockUnit.y) < UNIT_SIZE) { return true; } } return false; }
public static void remove(List<BlockUnit> allBlockUnits, int j) { for (int i = allBlockUnits.size() - 1; i >= 0; i--) { if ((int) ((allBlockUnits.get(i).y - BEGIN) / 50) == j) allBlockUnits.remove(i); } }
严域俊:将收藏功能添加到每个小游戏界面
吴恒佚:将收藏功能添加到每个小游戏界面
曾程:博客、页面设计
刘辰:弹框及页面设计
邓煜坤:改图标
你们一块儿决定:决定不增长背景音乐了3d
严域俊 | 吴恒佚 | 曾程 | 刘辰 | 邓煜坤 |
---|---|---|---|---|
3.5 | 3 | 3 | 3.5 | 3.5 |
todolist电脑更新后就没了TAT 从新打开后以前的东西就没了 我就从这一天开始须要实现的功能写起了
更新:找到原来的那个界面了,将图片改了
code