Amerikranian / Lucia-examples

Short examples demonstrating Lucia functionality
2 stars 3 forks source link

Checking location example #1

Open davidkreynolds opened 3 years ago

davidkreynolds commented 3 years ago

Hi, Imagine a game with a player, and one or more moving targets. The targets move automatically, and the player can be moved using right and left arrow. Can you include an example of how to locate the player, and calculate whether his bullet has hit the target. I'm sure that some of this is in the docs, but I've had difficulty getting any documentation on this package. Thanks, David.

Amerikranian commented 3 years ago

Hello. What you are requesting is not a part of Lucia. It would heavily depend on your implementation of the game. For example, you could have a sorted list of coordinates for entities and then perform something like a Binary Search to find whether they collide. This assumes that your game is only 1D, however. Another approach would be to employ some techniques discussed here, but this also makes several assumptions about your game. As you can see, there is not a right way to do it. Lucia was designed to be a basic framework, not a true game engine with collision and such. You can find a longer example of how to use Lucia here if you are still confused on how it works. However, I wish to provide a basic warning. From what I understand, the current version of Lucia is deprecated. I think somebody is working on Lucia 2.0, but I do not know so for certain. Default Lucia tools like menus remove the ability to use common patterns like State because they block while the menus are up. Finally, Lucia sound pool does not support caching, which means that any time you play a sound it immediately gets discarded and must be loaded into memory before use. I recommend avoiding using the engine and switch directly to Pygame / Pyglet / insert another less well-known engine here. I would also recommend using Cytolk and Synthizer for speech and sound output respectively. It may be more work at first, but you will not be limited in what you can do.

davidkreynolds commented 3 years ago

Hi,

Thanks for all this. I’d started an invaders game in Pygame, but needed to position sounds.

I’ll take a look at the modules you recommended.

Thanks so much for responding in such an informative manner,

David.

From: Amerikranian @.> Sent: 11 June 2021 15:55 To: Amerikranian/Lucia-examples @.> Cc: davidkreynolds @.>; Author @.> Subject: Re: [Amerikranian/Lucia-examples] Checking location example (#1)

Hello. What you are requesting is not a part of Lucia. It would heavily depend on your implementation of the game. For example, you could have a sorted list of coordinates for entities and then perform something like a Binary Search https://en.wikipedia.org/wiki/Binary_search_algorithm#:~:text=In%20computer%20science%2C%20binary%20search,middle%20element%20of%20the%20array. to find whether they collide. This assumes that your game is only 1D, however. Another approach would be to employ some techniques discussed here https://github.com/camlorn/collision_tutorial , but this also makes several assumptions about your game. As you can see, there is not a right way to do it. Lucia was designed to be a basic framework, not a true game engine with collision and such. You can find a longer example of how to use Lucia here https://github.com/Amerikranian/Finger-Panic-Python-Version if you are still confused on how it works. However, I wish to provide a basic warning. From what I understand, the current version of Lucia is deprecated. I think somebody is working on Lucia 2.0, but I do not know so for certain. Default Lucia tools like menus remove the ability to use common patterns like State because they block while the menus are up. Finally, Lucia sound pool does not support caching, which means that any time you play a sound it immediately gets discarded and must be loaded into memory before use. I recommend avoiding using the engine and switch directly to Pygame / Pyglet / insert another less well-known engine here. I would also recommend using Cytolk https://github.com/pauliyobo/cytolk and Synthizer https://synthizer.github.io/ for speech and sound output respectively. It may be more work at first, but you will not be limited in what you can do.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Amerikranian/Lucia-examples/issues/1#issuecomment-859639116 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AD4CGCDYOBMSPTAUJ3CIHX3TSIPTVANCNFSM46QS2RPQ . https://github.com/notifications/beacon/AD4CGCCCUCVKV234RMLGC63TSIPTVA5CNFSM46QS2RP2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGM6Q2TA.gif