本文整理汇总了Java中com.b3dgs.lionengine.util.UtilMath类的典型用法代码示例。如果您正苦于以下问题:Java UtilMath类的具体用法?Java UtilMath怎么用?Java UtilMath使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UtilMath类属于com.b3dgs.lionengine.util包,在下文中一共展示了UtilMath类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.b3dgs.lionengine.util.UtilMath; //导入依赖的package包/类
@Override
public void update(double extrp)
{
pointer.update(extrp);
if (pointer.getClick() == 1)
{
camera.moveLocation(extrp, -pointer.getMoveX(), pointer.getMoveY());
}
else if (pointer.getClick() == 2)
{
scale = UtilMath.clamp(scale + pointer.getMoveY() / 100.0, 0.5, 1.42);
changer.setResolution(source.getScaled(scale, scale));
}
super.update(extrp);
landscape.update(extrp, camera);
camera.moveLocation(extrp, 0.0, 0.0);
}
示例2: update
import com.b3dgs.lionengine.util.UtilMath; //导入依赖的package包/类
@Override
public void update(double extrp, int x, int y, double speed)
{
backcolorA.setOffsetY(y);
moon.setOffsetY(moonOffset - totalHeight + getOffsetY());
final double mx = mountain.getOffsetX() + speed * 0.24;
mountain.setOffsetX(UtilMath.wrapDouble(mx, 0.0, mountainSprite.getWidth()));
mountain.setOffsetY(y);
if (flickering)
{
flickerCount = (flickerCount + 1) % 2;
if (flickerCount == 0)
{
flickerType = !flickerType;
}
}
}
示例3: waterEffect
import com.b3dgs.lionengine.util.UtilMath; //导入依赖的package包/类
/**
* Update water effect.
*
* @param g The graphics output.
* @param speed The effect speed.
* @param frequency The effect frequency.
* @param amplitude The effect amplitude.
* @param offsetForce The offset force.
*/
private void waterEffect(Graphic g, double speed, double frequency, double amplitude, double offsetForce)
{
final int oy = py + (int) water.getHeight();
for (int y = screenHeight + getNominal() - UNKNOWN_OFFSET + oy; y < screenHeight; y++)
{
final double inside = Math.cos(UtilMath.wrapDouble(y + wx * frequency, 0.0, 360.0)) * amplitude;
final double outside = Math.cos(wx) * offsetForce;
g.copyArea(0, y, screenWidth, 1, (int) (inside + outside), 0);
}
}
示例4: update
import com.b3dgs.lionengine.util.UtilMath; //导入依赖的package包/类
@Override
public void update(double extrp, int x, int y, double speed)
{
anim.update(extrp);
data.setOffsetX(data.getOffsetX() + speed);
data.setOffsetX(UtilMath.wrapDouble(data.getOffsetX(), 0.0, anim.getTileWidth()));
data.setOffsetY(y);
height += water.getSpeed() * extrp;
height = UtilMath.wrapDouble(height, 0.0, 360.0);
water.setHeight(Math.sin(height) * water.getDepth());
py = y;
wx += WATER_EFFECT_SPEED * extrp;
}
示例5: update
import com.b3dgs.lionengine.util.UtilMath; //导入依赖的package包/类
@Override
public void update(double extrp)
{
for (int i = 0; i < layers.length; i++)
{
y[i] = UtilMath.wrapDouble(y[i] + speed[i] * extrp, 0, viewer.getHeight());
}
}
示例6: update
import com.b3dgs.lionengine.util.UtilMath; //导入依赖的package包/类
@Override
public void update(double extrp)
{
if (area != null)
{
area.set(UtilMath.getRounded(cursor.getX(), cursor.getWidth()),
UtilMath.getRounded(cursor.getY(), cursor.getHeight()),
area.getWidthReal(),
area.getHeightReal());
}
}
示例7: increaseLevel
import com.b3dgs.lionengine.util.UtilMath; //导入依赖的package包/类
/**
* Increase weapon level.
*/
public void increaseLevel()
{
launcher.setLevel(UtilMath.clamp(launcher.getLevel() + 1, 0, Constant.WEAPON_LEVEL_MAX));
}