📄 collisionbounds.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
package com.golden.gamedev.object.collision;
import com.golden.gamedev.object.*;
import java.awt.Rectangle;
// Referenced classes of package com.golden.gamedev.object.collision:
// CollisionRect, CollisionShape
public abstract class CollisionBounds extends CollisionManager
{
public static final int LEFT_COLLISION = 1;
public static final int RIGHT_COLLISION = 2;
public static final int TOP_COLLISION = 4;
public static final int BOTTOM_COLLISION = 8;
private static final SpriteGroup e = new SpriteGroup("Dummy");
private final Rectangle f;
private Sprite g;
private int h;
private int i;
private int j;
protected final CollisionRect rect1;
public CollisionBounds(int k, int l, int i1, int j1)
{
f = new Rectangle();
rect1 = new CollisionRect();
f.setBounds(k, l, i1, j1);
}
public CollisionBounds(Background background)
{
f = new Rectangle();
rect1 = new CollisionRect();
f.setBounds(0, 0, background.getWidth(), background.getHeight());
}
public void setCollisionGroup(SpriteGroup spritegroup, SpriteGroup spritegroup1)
{
super.setCollisionGroup(spritegroup, e);
}
public void checkCollision()
{
SpriteGroup spritegroup;
if(!(spritegroup = getGroup1()).isActive()) goto _L2; else goto _L1
_L1:
Sprite asprite[];
int k;
int l;
asprite = spritegroup.getSprites();
k = spritegroup.getSize();
l = 0;
goto _L3
_L6:
CollisionShape collisionshape;
CollisionShape collisionshape1;
g = asprite[l];
if(!g.isActive())
continue; /* Loop/switch isn't completed */
collisionshape1 = getCollisionShape1(g);
collisionshape1;
collisionshape = collisionshape1;
JVM INSTR ifnull 331;
goto _L4 _L5
_L4:
break MISSING_BLOCK_LABEL_60;
_L5:
continue; /* Loop/switch isn't completed */
h = 0;
i = (int)g.getX();
j = (int)g.getY();
if(collisionshape.getX() < (double)f.x)
{
i = f.x;
h |= 0x1;
}
if(collisionshape.getY() < (double)f.y)
{
j = f.y;
h |= 0x4;
}
if(collisionshape.getX() + (double)collisionshape.getWidth() > (double)(f.x + f.width))
{
i = (f.x + f.width) - collisionshape.getWidth();
h |= 0x2;
}
if(collisionshape.getY() + (double)collisionshape.getHeight() > (double)(f.y + f.height))
{
j = (f.y + f.height) - collisionshape.getHeight();
h |= 0x8;
}
if(h != 0)
collided(g);
l++;
_L3:
if(l < k) goto _L6; else goto _L2
_L2:
}
public void revertPosition1()
{
g.forceX(i);
g.forceY(j);
}
public CollisionShape getCollisionShape1(Sprite sprite)
{
rect1.setBounds(sprite.getX(), sprite.getY(), sprite.getWidth(), sprite.getHeight());
return rect1;
}
public boolean isCollisionSide(int k)
{
return (h & k) != 0;
}
public void setBoundary(int k, int l, int i1, int j1)
{
f.setBounds(k, l, i1, j1);
}
public Rectangle getBoundary()
{
return f;
}
public abstract void collided(Sprite sprite);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -