javascript canvas检测一个数字 [英] javascript canvas detect a number

查看:117
本文介绍了javascript canvas检测一个数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个游戏,想法是收集数字,如果你收集3你获得积分,如果你收集4你失分。数字正在下降所以我需要通过使用按钮上的字符来收集它们,我知道碰撞检测但这还不够,因为它无法识别数字只是重叠。有没有办法(功能)识别画布上的数字?



一切顺利,



Marco

I am doing a game, the idea is to collect numbers if you collect 3 you get points if you collect 4 you lose points. The numbers are falling down so I need to collect them by using a character at the button, I know about collision detection but that is not enough as it cannot recognize numbers just the overlapping. Is there a way (function) to recognize numbers on a canvas?

All the best,

Marco

推荐答案

从你的问题来看,我认为没有必要承认任何事情。如果你在代码中删除数字,你就会知道它们是什么。因此,从这个角度来看,这个问题看起来很简单:你定义了一组数字对象,每个对象都包含你需要的数字,当前位置和其他几何参数。其他一切都是代码设计的问题。你的设计。 :-)



-SA
From your question, I cannot see any need in "recognition" of anything. If you "drop" numbers in your code, you know what are they. So, from this point of view, the problem looks quite trivial: you define a set of number objects each holding the number, current location and other geometric parameters you need to have. Everything else is the matter of the design of your code. Your design. :-)

—SA


这篇关于javascript canvas检测一个数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆