spark.java

来自「手机游戏」· Java 代码 · 共 62 行

JAVA
62
字号
// Decompiled by Jad v1.5.7f. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Spark.java

package matchit2;

import javax.microedition.lcdui.Graphics;

// Referenced classes of package matchit2:
//            ListItem

class Spark extends ListItem
{

    Spark(int x, int y, int vx, int vy, int colour, int ticksToLive)
    {
        this.x = x;
        this.y = y;
        oldX = x;
        oldY = y;
        this.vx = vx;
        this.vy = vy;
        this.colour = colour;
        this.ticksToLive = ticksToLive;
    }

    void tick()
    {
        if(--ticksToLive <= 0)
        {
            remove();
        } else
        {
            oldX = x;
            oldY = y;
            x += vx;
            y += vy;
            vx -= vx * 25 >> 8;
            vy -= vy * 25 >> 8;
            vy += 25;
        }
    }

    void draw(Graphics g)
    {
        g.setColor(colour);
        g.drawLine(x >> 8, y >> 8, oldX >> 8, oldY >> 8);
    }

    private static final int DRAG_FACTOR = 25;
    private static final int GRAVITATIONAL_ACCELERATION = 25;
    private int x;
    private int y;
    private int oldX;
    private int oldY;
    private int vx;
    private int vy;
    private final int colour;
    private int ticksToLive;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?