Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cant handle multitouch operations and it is really slow #73

Closed
AlenToma opened this issue Nov 15, 2022 · 4 comments
Closed

Cant handle multitouch operations and it is really slow #73

AlenToma opened this issue Nov 15, 2022 · 4 comments

Comments

@AlenToma
Copy link

Hi, new here to the game world as I have never developed a game before and wanted to start one.

So I started building a Rythem game and used this library.

I got the game ruling and wanted to start building the score operation, eg when user touches the ruling down block.

The touch do not always get detected and also multitouch do not work ever in android.

I may be doing something wrong here.

Here is the touch system file

export default (entities: any, { touches }: { touches: TouchEvent[] }) => {
    try {
        const infoHolder = entities.infoHolder as InfoBeholder;
        const keys = Object.keys(entities);

        touches.filter(x => x.type === "press").forEach(x => {
            for (const key of keys) {
                const component = entities[key] as INoteTick;


                if (!component || component.type != "Note" || !component.enabled) {
                    continue;
                }
                let top1 = component.position.top;
                let top2 = component.position.top + component.position.height;

                const y1 = x.event.pageY + (component.position.height / 2);
                const y2 = x.event.pageY;
                const left1 = component.position.left;
                const left2 = component.position.left + component.position.width;



                const x1 = x.event.pageX;
                if (((y1 > top1 && y1 < top2) || (y2 > top1 && y2 < top2))
                    &&
                    (x1 > left1 && left2 > x1)
                ) {
                    // console.log(component.position)
                    infoHolder.score++;
                    component.touched = true;
                }
            }
        });

        return entities;


    } catch (e) {
        console.error(e);
        throw e;
    }
}

here is the project url if you want to have a look https://github.com/AlenToma/MelodyTappar

@AlenToma
Copy link
Author

After Looking at this extra time I found that the multitouch trigger but because I click a little to fast that when system operation is on going and I touch the box it will not trigger.

and in the next tick touches is then empty.

It should save the touches even when the system operation is on-going and in the next tick it should present the old and new one.

Please have a look at the code and let me know if there is another way I could check the touches outside the tick operations.

@AlenToma
Copy link
Author

Sorry I did not take notice that I must take notice of the bpm when validation and position.

It is working now, Will close this issue as at is not an issue.

@bberak
Copy link
Owner

bberak commented Nov 18, 2022

Awesome @AlenToma - glad you got this sorted out 🙏

@bberak
Copy link
Owner

bberak commented Nov 18, 2022

Also, this sounds like a cool project @AlenToma - I'll try check it out this weekend 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants