- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
星際大戰:畫布(Canvas)與動畫(ImageSprite) 靜宜大學資管系 楊子青 1. Canvas Component A two-dimensional touch-sensitive rectangular panel on which drawing can be done and sprites can be moved. Any location on the Canvas can be specified as a pair of (X, Y) values, where X is the number of pixels away from the left edge of the Canvas Y is the number of pixels away from the top edge of the Canvas There are events to tell when and where a Canvas has been touched or a Sprite has been dragged. The Canvas coordinate system Adding a Canvas Component to App You can drag a Canvas component into your app from the Basic palette. specify the Canvas’s Width and Height. Often span the width of the device screen: “Fill parent” Height: 300 2. ImageSprite component is an animated object that is contained by a canvas can react to touches and drags, interact with other sprites (image sprites and other balls) and the edge of the canvas, and move according to its properties. 介面設計 介面內容 初始設定 時間到,隨機移動SaucerSprite的X軸 2.2 拖曳RocketSprite,讓其水平移動 不同方向對應之Heading角度值 火箭發射子彈,子彈往上跑 子彈沒打到,到達邊界則消失 子彈打到(碰撞),分數加1 練習 * 靜宜大學資管系 楊子青 * 0 Y rocket.png Picture RocketSprite 230 Y saucer.png Picture SaucerSprite Green PaitColor Bullet (屬於Ball) Center AlignHorizontal HorizontalArrangement1 8 Radius 0 Text ScoreLabel Score: Text Label1 3000 TimerInterval Clock1 Reset Text ResetButton 300 pixels Height Fill parent Width Canvas1 Space Invaders Title Screen1 屬性值 屬性 元件 2.1 Timer event One way to specify animation in App Inventor is to change an object in response to a timer event. Most commonly, you’ll move sprites to different locations on the canvas at set time intervals. 2.3 ImageSprite的Heading與Speed屬性 Heading indicates the direction in which the ImageSprite should move, in degrees. For example, 0 means due right, 90 means straight up, 180 means due left, and so on. Speed specifies how many pixels the ImageSprite should move whenever its Interval passes. 0 45 90 135 180 225 270 315 2.4 偵測是否遇到邊界
文档评论(0)