npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

gm-game-melon

v0.0.9

Published

``` npm install gm-game-melon ```

Downloads

19

Readme

gm-game-melon

合成大西瓜

安装
npm install gm-game-melon
使用
必须开启 "enableSkia": "true"
  • json
{
    "usingComponents": {
        "game-melon": "gm-game-melon/melon"
    }
}
  • js
Page({
  data: {
    gameshow: true,
    gameSource: {
      gravityX: 0,//x轴重力(小于0:x轴偏左)
      gravityY: 100,//y轴重力(小于0:Y轴偏上)
      fixDef: {
        density: 0.000000001,//密度
        friction: 1.0,//摩擦力(0-1)0:没有摩擦力
        restitution: 0.2,//0.2;//回复力(0-1)0:不会反弹
        fixedRotation: true,//是否禁止刚体旋转 true:允许旋转
      },
      hechengInterval: 500,//两个合成间隔时间 (毫秒)

      world: [
        // { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01EkAhl51FJvdGaiIy3_!!1080040467.png", direction: "bottom", width: 750, height: 10 },
        // { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01EkAhl51FJvdGaiIy3_!!1080040467.png", direction: "top", width: 750, height: 10 },
        // { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01RVyIAg1FJvd81pxEe_!!1080040467.png", direction: "left", width: 8, height: 1716 },
        // { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01RVyIAg1FJvd81pxEe_!!1080040467.png", direction: "right", width: 8, height: 1716 }

        { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN011tf1yN1FJvbf2Giw2_!!1080040467.png", direction: "bottom", show: true, width: 750, height: 10 },
        { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN011tf1yN1FJvbf2Giw2_!!1080040467.png", direction: "top", show: true, width: 750, height: 10 },
        { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01289gtt1FJvbbeuLLr_!!1080040467.png", direction: "left", show: true, width: 8, height: 1716 },
        { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01289gtt1FJvbbeuLLr_!!1080040467.png", direction: "right", show: true, width: 8, height: 1716 }
      ],
      paddingLeft: 50,
      paddingRight: 50,
      curDefIdx: 0,//最大顶部默认球下标,相对imgArr数组
      maxDefIdx: 3,//最大顶部默认球下标
      defCenterY: 200,//顶部生成元素Y轴中心坐标,默认Y轴中心点
      alignType: "bottom",//相对defCenterY位置对其方式 默认center:中心点对其 top:顶部对齐 bottom:底部对齐
      lifeLine: 400,//生命线,超过了就结束游戏
      warnHeight: 100,//危险区域,距离结束线距离,在此范围内,就回调危险提示方法
      imgArr: [
        //球形
        // { type: 0, shape: "circle", val: 5, src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01UL03sF1FJvd8YzHiG_!!1080040467.png", width: 750, height: 50, scoreImg: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01SJk6cq1FJvdDwlMQr_!!1080040467.png", width: 57, height: 29 } },
        { type: 0, shape: "circle", val: 5, src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01xlMYpZ1FJvdDoaMjf_!!1080040467.png", audioName: "default", width: 41, height: 41, scoreImg: { src: "https://img.alicdn.com/imgextra/i1/1080040467/O1CN01SJk6cq1FJvdDwlMQr_!!1080040467.png", width: 57, height: 29, centerX: true, y: 500, showTime: 1000 } },
        { type: 1, shape: "circle", val: 10, src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01YgLY2Q1FJvdCwQITP_!!1080040467.png", audioName: "default", width: 67, height: 67, scoreImg: { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01mzt20k1FJvdETTEDf_!!1080040467.png", width: 89, height: 29, centerX: true, y: 500, showTime: 1000 } },
        { type: 2, shape: "circle", val: 15, src: "https://img.alicdn.com/imgextra/i2/1080040467/O1CN01D83Syx1FJvdDobuLO_!!1080040467.png", audioName: "default", width: 104, height: 104, scoreImg: { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01Mj0EIq1FJvd85DyGd_!!1080040467.png", width: 89, height: 29, centerX: true, y: 500, showTime: 1000 } },
        { type: 3, shape: "circle", val: 20, src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01FbABGP1FJvd8h2RVa_!!1080040467.png", audioName: "default", width: 138, height: 138, scoreImg: { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01k61HUv1FJvdAxyfM3_!!1080040467.png", width: 89, height: 29, centerX: true, y: 500, showTime: 1000 } },
        { type: 4, shape: "circle", val: 25, src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01zOo7So1FJvd8wZchf_!!1080040467.png", audioName: "default", width: 189, height: 189, scoreImg: { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01inRqdi1FJvd5kAIkM_!!1080040467.png", width: 89, height: 29, centerX: true, y: 500, showTime: 1000 } },
        { type: 5, shape: "circle", val: 30, src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01Oh77NE1FJvdCwQlaJ_!!1080040467.png", audioName: "default", width: 236, height: 236, scoreImg: { src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01n7CzQz1FJvd3rabsk_!!1080040467.png", width: 89, height: 29, centerX: true, y: 500, showTime: 1000 } },
        { type: 6, shape: "circle", val: 100, src: "https://img.alicdn.com/imgextra/i4/1080040467/O1CN01gpvchE1FJvd8h2iAf_!!1080040467.png", audioName: "default", width: 292, height: 293, scoreImg: { src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01tnc6gS1FJvdETDmkK_!!1080040467.png", width: 171, height: 49, centerX: true, y: 500, showTime: 1000 } },
        { type: 7, shape: "circle", val: 0, src: "https://img.alicdn.com/imgextra/i3/1080040467/O1CN01AHBy5i1FJvcyyWdLu_!!1080040467.png", width: 360, height: 361, centerX: true, y: 500, showTime: 1000 },
      ],
      audioObj: {
        default: { audioSrc: "http://isv-vod.alibabausercontent.com/RGjZJMdpNgKGVQeEyw8/6cnFJEwIj5AGWCcBlTf?auth_key=1616480580-0-0-d0561ac34c6e55e1502b94b0bf20216f&w=0&h=0&e=sd&t=212b035516162213804197727e85ac" },//默认音效
      },
    },
  },
  onLoad() {
  },

  onRef(game) {
    this.gameComponent = game;
  },
  /**游戏初始化完成*/
  onInitDone() {
    console.log("initDone...")
    my.alert({
      content: "游戏初始化完成"
    })
  },
  /**游戏开始 */
  beginFun() {
    if (!!this.gameComponent) {
      this.gameComponent.start();
    }

  },
  resetFun() {
    if (!!this.gameComponent) {
      this.gameComponent.reset();
    }
  },
  drupFun() {
    if (!!this.gameComponent) {
      this.gameComponent.drup();
    }
  },
  onDrupCallBack(img) {
    // 敲除元素成功后回调
    my.alert({ content: "敲除成功" })
  },
  refreshFun() {
    // 刷新即将掉落的元素
    if (!!this.gameComponent) {
      this.gameComponent.refreshFun();
    }
  },
  onRefreshCallBack() {
    // 刷新回调函数
    my.alert({ content: "刷新成功" })
  },
  onWarnCallBack() {
    // 进入危险区域回调方法
    my.alert({ content: "危险了,快使用道具解除危险" })
  },
  /**游戏结束 */
  onFinish(item) {
    // item.totalScore 总分数
    // item.maxObj 最大合成对象 对应imgArr里面的元素
    let type;
    try {
      type = item.maxObj.type;
    } catch (e) { }
    my.alert({
      content: "游戏结束:" + item.totalScore + "maxType:" + type
    })
  },
  /**游戏切换 */
  switchFun() {
    this.setData({ gameshow: !this.data.gameshow });
  },
  onUpdate(item) {
    /*  my.alert({
       content: item.totalScore
     }); */
    // totalScore:总分数
    // item.img:消除图片对象 对应imgArr里面元素
    this.setData({
      totalScore: item.totalScore,
      img: item.img,
    })
  },
});
  • xaml
  <!-- 
    onInitDone:游戏组件初始化完成
    onUpdate:游戏合成回调
    onFinish:游戏结束回调
    onDrupCallBack:敲除技能回调
    onRefreshCallBack:刷新技能回调
    onWarnCallBack:进入危险区域回调
  -->
  <gm-game-melon gameSource="{{gameSource}}" onInitDone="onInitDone" onUpdate="onUpdate" onFinish="onFinish" onDrupCallBack="onDrupCallBack" onRefreshCallBack="onRefreshCallBack" onWarnCallBack="onWarnCallBack" onRef="onRef" />