M
M
Maxim Plotnikov2020-10-14 12:03:07
PHP
Maxim Plotnikov, 2020-10-14 12:03:07

How can I create a task in the game?

Hello everyone, here I am writing some game now. And I wondered how you can organize the tracking and execution of the task by the user.
Let me give you an example, I have a bucket and a stream. A person needs to collect 5 buckets to complete the task, but the collection of water occurs in a separate piece of code, and there are no ideas how to track the completion of the task.
You can simply bring the logic in the form of text, well, or some kind of diagram.
I'll be glad, thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bqio, 2020-10-14
@kakisaebalsujit

A task (quest) is a listener for the player's actions. As soon as the player performs a certain action, the current conditions of the task change. Your engine should have some kind of middleware that will listen to all actions and all active tasks, and when the conditions of the task are met, it will mark it as completed and will not listen to it anymore. When the player draws water, the state of the task should change in your code.
All user actions will have to go through this middleware, and the kernel, by their type, will determine the "type" of the action (a set of water) and change the state of the task.
I see it this way. Others can correct me.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question