Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function onDrag(position:int):void
- {
- if (position < 1 || position > 14) // There is no land here
- return;
- if (landscapeHeight[position] < (dragStartY - FlxG.mouse.y))
- {
- if (position != 1)
- landscapeHeight[position - 1] += Math.random() * 0.7;
- landscapeHeight[position] += 1.0;
- if (position != 14)
- landscapeHeight[position + 1] += Math.random() * 0.7;
- }
- if ((129 - landscapeHeight[position]) < FlxG.mouse.y)
- {
- if (position != 1)
- {
- landscapeHeight[position - 1] -= Math.random() * 0.7;
- if (landscapeHeight[position - 1] < 0)
- landscapeHeight[position - 1] = 0;
- }
- landscapeHeight[position] -= 1.0;
- if (landscapeHeight[position] < 0)
- landscapeHeight[position] = 0;
- if (position != 14)
- {
- landscapeHeight[position + 1] -= Math.random() * 0.7;
- if (landscapeHeight[position + 1] < 0)
- landscapeHeight[position + 1] = 0;
- }
- }
- redraw();
- }
Add Comment
Please, Sign In to add comment