Good vs. Evil

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,799
248
11 and I made a simple point/coordinate struct.
It isn't much but it allows me to more easily work with coordinates as I used to just use tuples and it has some nice functions already. All of which are subjected to automated testing using doc tests.

Now, time to expand the PointWithItem struct to expose similar methods as the point struct. Just with also exposing a way to set the contained item and stuff. I probably should also look if I can easily implement .map and all that fun stuff on it :)
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,799
248
11 so... it turns out that the code I copied to create diagonal lines is bugged. It also turns out to not exactly be the easiest algorithm to implement so I may decide to just remove it all together.

As a work around I just decided to limit the player to selecting horizontal and vertical lines only. Also, I added code allowing the player to place "walls". So.... here is a picture of how the "game" looks right as of now:
upload_2019-6-25_20-15-45.png

the white square is supposed to be the square that your mouse is hovering over. No idea why it isn't covering a whole square, that somehow broke when making the screenshot.
the indigo lines= walls that are placed
orange =ground/dirt
green = grass
blue=water
gray = stone

next on the list is to add random terrains, rather than this rather obnoxious pattern that I only used so I could test if scrolling and zooming worked.
After that, a way to place characters which move around randomly. Then, making them unable to move through certain cells.

Also, fix that weird mouse position problem......
 
  • Like
Reactions: GamerwithnoGame

duckfan77

Popular Member
Mar 18, 2013
80
683
118
10 I very much understand creating a point struct/class, I've done so myself to make dealing with them easier.
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,799
248
10 generating the terrain may be harder than I hoped it would be.....
unknown.png

I found a crate that implements various kinds of noise algorithms. I was hoping I could just use those as if but clearly, I can't.
For those interested, the crate that I use is https://docs.rs/noise/0.5.1/noise/#structs
and my code to turn the returned floats into my terrain types is:
Code:
let num = num +1.0;
if num <=0.5 {
CellType::Water
} else if num > 0.5 && num <=1.0 {
CellType::Grass
} else if num > 1.0 && num <=1.5 {
CellType::Ground
} else {
CellType::Stone
}
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,799
248
10 managed to make it a lot better:
unknown.png

and a weird one
unknown.png
They aren't the most impressive maps yet but its good enough for now :)
 

lenscas

Over-Achiever
Jul 31, 2013
2,015
1,799
248
10 and another massive cleanup pushed.

This time I didn't really touch any code but just started using pub use and cleaned up every use statement. The result? 17 files changed, 206 additions and 140 deletions.