diff options
Diffstat (limited to 'src/LivingVillage.Desktop/VillageArt.fs')
| -rw-r--r-- | src/LivingVillage.Desktop/VillageArt.fs | 47 |
1 files changed, 32 insertions, 15 deletions
diff --git a/src/LivingVillage.Desktop/VillageArt.fs b/src/LivingVillage.Desktop/VillageArt.fs index 5883a97..a66474b 100644 --- a/src/LivingVillage.Desktop/VillageArt.fs +++ b/src/LivingVillage.Desktop/VillageArt.fs @@ -102,6 +102,7 @@ module VillageArt = | WallWoodSprite | WallWindowSprite | DoorSprite + | WaterSpriteB type private XnaColor = Microsoft.Xna.Framework.Color type private XnaRectangle = Microsoft.Xna.Framework.Rectangle @@ -143,15 +144,7 @@ module VillageArt = { Origin = position 25 18 Grounds = - [ ground Water 10 2 - ground Water 10 3 - ground Water 10 4 - ground Water 10 5 - ground Water 10 6 - ground Water 10 7 - ground Water 11 4 - ground Water 11 5 - ground StonePath 3 5 + [ ground StonePath 3 5 ground StonePath 4 5 ground StonePath 5 5 ground StonePath 6 5 @@ -161,10 +154,26 @@ module VillageArt = ground StonePath 10 5 ground StonePath 11 5 ground StonePath 6 6 - ground StonePath 6 7 ] + ground StonePath 6 7 + ground StonePath 6 8 + ground StonePath 6 9 + ground StonePath 6 10 + for x in 0 .. 5 do + ground StonePath x 11 + for x in 9 .. 19 do + ground StonePath x 11 + for x in 1 .. 18 do + ground StonePath x 14 + ground Water 6 11 + ground Water 7 11 + ground Water 8 11 + for x in 0 .. 19 do + ground Water x 12 + for x in 2 .. 17 do + ground Water x 13 ] Props = [ renderProp House 6 5 - renderProp Bridge 10 5 + renderProp Bridge 6 11 renderProp BambooGrove 3 2 renderProp VegetablePatch 8 7 ] Interior = @@ -190,7 +199,7 @@ module VillageArt = [ for dx in -2 .. 1 do for dy in -2 .. 0 do yield position (x + dx) (y + dy) ] - | Bridge -> [ position x y; position x (y + 1) ] + | Bridge -> [ position x y; position x (y + 1); position x (y + 2) ] | BambooGrove -> [ position x y; position x (y + 1); position (x + 1) y ] | VegetablePatch -> [ position x y; position (x + 1) y ]) |> many @@ -212,6 +221,10 @@ module VillageArt = let animationFrame (tick: int64) : AnimationFrame = if positiveModulo64 8L tick < 4L then FrameOne else FrameTwo + /// Water surface ripple phase: flips every 32 simulation ticks, fully deterministic. + let waterFrameTick (tick: int64) : int = + int (positiveModulo64 2L (tick / 32L)) + let directionFromVector (vector: Vec2) : FacingDirection = if abs vector.X < 0.001f && abs vector.Y < 0.001f then SouthFacing @@ -271,7 +284,7 @@ module VillageArt = let characterAtlasRelativePath = "Assets/jiangnan-characters.png" let interiorAtlasRelativePath = "Assets/jiangnan-interior.png" - let worldTileCount = 13 + let worldTileCount = 14 let worldAtlasWidth = Sim.tilePixels * worldTileCount let worldAtlasHeight = Sim.tilePixels let characterAtlasWidth = 32 * 4 * 4 * 2 @@ -313,6 +326,7 @@ module VillageArt = | WallWoodSprite -> 10 | WallWindowSprite -> 11 | DoorSprite -> 12 + | WaterSpriteB -> 13 XnaRectangle(index * Sim.tilePixels, 0, Sim.tilePixels, Sim.tilePixels) let private tilePosition x y : TilePosition = @@ -350,9 +364,11 @@ module VillageArt = (viewportWidth: int) (viewportHeight: int) (plan: JiangnanRenderPlan) + (tick: int64) (tint: XnaColor) = let draw position sprite = drawWorldTile spriteBatch textures camera viewportWidth viewportHeight position sprite tint + let rippleFrame = waterFrameTick tick let tx0 = max 0 (int camera.X / Sim.tilePixels) let ty0 = max 0 (int camera.Y / Sim.tilePixels) @@ -366,7 +382,7 @@ module VillageArt = let position = worldTile plan localPosition let sprite = match kind with - | Water -> WaterSprite + | Water -> if rippleFrame = 0 then WaterSprite else WaterSpriteB | StonePath -> StonePathSprite draw position sprite @@ -383,7 +399,8 @@ module VillageArt = let drawBridge localPosition = let position = worldTile plan localPosition draw position BridgeSprite - draw (offsetTile position 1 0) BridgeSprite + draw (offsetTile position 0 1) BridgeSprite + draw (offsetTile position 0 2) BridgeSprite let drawBamboo localPosition = let position = worldTile plan localPosition |
