![]() ![]() The solution to the given problem is to emulate the Game of Life not on an infinite planar grid, but rather on a toroidal grid that is, we fix our 20×20 universe and treat the top row as if it borders the bottom row and the left row as if it borders the right row. One noticeable problem cropped up, however: patterns with density around 90% tended to live for an extremely long time due to edge effects that caused the pattern to explode out of the original 20×20 box initially, even though they would almost entirely die off within the box. To test this hypothesis, I wrote a simple Golly Python script that generated random 20×20 patterns of varying densities and checked how long it took for them to stabilize. Var _released = get_tree().A couple of weeks ago, I posted some intuition that suggested that, in Conway’s Game of Life, the longest-lived patterns should on average be those with density right around 37.5%. If Input.is_action_just_pressed("ui_cancel"): ![]() Set_cellv(_pos, 1-get_cellv(_pos)) # normalize value to 1 or zero Var _pos = (get_global_mouse_position()/_TILE_SIZE).floor() # remove decimal If event.is_action_pressed("_click"): # get mouse position and divide by tile size ![]() My code from mine which allows user input to "place" tiles, though the code's not terribly efficient or legible if you're not familiar with it: extends TileMapĬonst _TILE_SIZE = 32 # math for mouse input However, this is a more recent one and will likely be a bit more up-to-date: I learned how to do this from a YT video but I can't seem to find it anymore. Always easier to make it work first then make it pretty. Then figure out whatever math you want to make them populate and probably have them "start" in a different place each level. (I just didn't need them.)Įssentially, you will want a 0 and 1 tile - one for your blank tile and one for your vines tile. It is only visual but it's not a huge leap at all to incorporate physics. I made something similar in a project I am working on. Look up Conway's Game of Life in Godot and find out about cellular automatons. So, if any of you have done something similar, I'd love your insight into how to best approach this in Godot 4.1. There's probably even other ways of doing this that I haven't even thought about, but I think I'd ask for your input before I waste too much time trying something that can't work. It looks like the animated tiles can only loop endlessly? I also saw that there is a way to animate tiles on a tilemap, but I haven't found a way to control these animations from code and make them run just once and then stop on the last frame and to find out if the animation has stopped so that I can then place the next tile. But then I'd have to find a way to place those areas exactly on the tilemap, so I'd have to go back and forth between tile coordinates and screen coordinates. I guess I could make a little scene for each vine-element, consisting of an area with a collision shape and an animated sprite. I made little four frame animations of the vine growing in different directions and my idea is to place that animation over a tile, let it run once and then stop on the last frame before I start a new animation on the next tile. Basically, the vines take over one tile of the grid after the other. I made a simple tile map for the environment and a small animated player character. I'm really in the early stages, trying to build a quick and dirty prototype to play around with the game mechanics, so for the moment I'm more interested in making things work than in making them look good. Hi, I'm trying to figure out the best way to approach this: I'm working on a 2D topdown style puzzle game, where the character tries to cut her way out of growing vines that surround her. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |