- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这段代码是让角色行走。我添加了所有库和 lwjgl 文件。这是控制台中打印的内容:
Error: Could not find or load main class org.newdawn.slick.tests.AlphaMapTest Caused by: java.lang.ClassNotFoundException: org.newdawn.slick.tests.AlphaMapTest
主要类(class):
import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;
public class Principal extends StateBasedGame{
private AppGameContainer contenitore;//contenitore
public Principal() throws SlickException {
super("Prova");
contenitore=new AppGameContainer(this);
contenitore.setDisplayMode(1280,720,false);
contenitore.setShowFPS(false);//non faccio vedere gli fps
contenitore.start();//fa partire initStateList
// TODO Auto-generated constructor stub
}
/*
* Inizializza la lista degli stati del gioco che con BasedGame non si poteva fare
*/
public void initStatesList(GameContainer arg0) throws SlickException {
// TODO Auto-generated method stub
this.addState(new Gioco());//aggiungo uno stato che � il nuovo gioco
}
public static void main(String[] args)
{
try
{
new Principal();
}
catch(SlickException exc)
{
exc.printStackTrace();//stampo l'eccezione
}
}
}
游戏类别:
import org.newdawn.slick.Animation;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn
.slick.SpriteSheet;
import org.newdawn.slick.geom.Rectangle;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
import org.w3c.dom.css.Rect;
public class Gioco extends BasicGameState {
Input entrata;
Image sfondo;
boolean toccato=false;
float hx=100,hy=100,cx=400,cy=100;
float x=300,y=300;
Animation omov;
SpriteSheet o;
int posizione=0;
public void init(GameContainer contenitore, StateBasedGame arg1) throws SlickException {
// TODO Auto-generated method stub
entrata=contenitore.getInput();
sfondo=new Image("/img/s.png");
o=new SpriteSheet("/img/movimento.png",32,32);
//allora si prende la dimensione dell'immagine e si sceglie
//l'area che si vuole ripetere movimento png � una 292x256
//ed � una matrice 8x9 quindi ho diviso 292/9 32,4(larghezza) e 256/8=32(altezza)
omov=new Animation(o,50);//100 indica ogni quanti ms far scattare il fotogramma
omov.setAutoUpdate(true);//animazione automatica fissarla a falsa e usa il metood update per aggiornare di default � true
omov.setLooping(true);//se non voglio mandare in loop animazione di default � true
}
public void render(GameContainer arg0, StateBasedGame arg1, Graphics g) throws SlickException {
// TODO Auto-generated method stub
sfondo.draw(0,0,1280,720);
omov.getImage(posizione).draw(x,y,60,60);
}
@Override
public void update(GameContainer arg0, StateBasedGame arg1, int arg2) throws SlickException {
// TODO Auto-generated method stub
}
public void movimentoOmino()
{
if(entrata.isKeyDown(Input.KEY_DOWN))//se sto premendo il tasto giu
{
if(posizione>3)
posizione=-1;
y++;
posizione++;
if (posizione==3)
posizione=0;
}
if(entrata.isKeyDown(Input.KEY_UP))//se sto premendo il tasto giu
{
if(posizione<27||posizione>29)
posizione=26;
y--;
posizione++;
if (posizione==30)
posizione=27;
}
if(entrata.isKeyDown(Input.KEY_LEFT))//se sto premendo il tasto giu
{
if(posizione>11||posizione<9)
posizione=8;
x--;
posizione++;
if (posizione==12)
posizione=9;
}
if(entrata.isKeyDown(Input.KEY_RIGHT))//se sto premendo il tasto giu
{
if(posizione<18||posizione>20)
posizione=17;
x++;
posizione++;
if (posizione==21)
posizione=18;
}
if(x<0)
{
x=0;
}
if(x+omov.getWidth()>1000)
{
x=1000-omov.getWidth();
}
if(y<0)
{
y=0;
}
if(y+omov.getHeight()>720)
{
y=720-omov.getHeight();
}
}
@Override
public int getID() {
// TODO Auto-generated method stub
return 0;
}
}
来自 SLICK 库的 ALPHAMAPTEST 类:
// Compiled from AlphaMapTest.java (version 1.5 : 49.0, super bit)
public class org.newdawn.slick.tests.AlphaMapTest extends org.newdawn.slick.BasicGame {
// Field descriptor #38 Lorg/newdawn/slick/Image;
private org.newdawn.slick.Image alphaMap;
// Field descriptor #38 Lorg/newdawn/slick/Image;
private org.newdawn.slick.Image textureMap;
// Method descriptor #41 ()V
// Stack: 2, Locals: 1
public AlphaMapTest();
0 aload_0 [this]
1 ldc <String "AlphaMap Test"> [1]
3 invokespecial org.newdawn.slick.BasicGame(java.lang.String) [2]
6 return
Line numbers:
[pc: 0, line: 26]
[pc: 6, line: 27]
Local variable table:
[pc: 0, pc: 7] local: this index: 0 type: org.newdawn.slick.tests.AlphaMapTest
// Method descriptor #48 (Lorg/newdawn/slick/GameContainer;)V
// Stack: 4, Locals: 2
public void init(org.newdawn.slick.GameContainer container) throws org.newdawn.slick.SlickException;
0 aload_0 [this]
1 new org.newdawn.slick.Image [3]
4 dup
5 ldc <String "testdata/alphamap.png"> [4]
7 invokespecial org.newdawn.slick.Image(java.lang.String) [5]
10 putfield org.newdawn.slick.tests.AlphaMapTest.alphaMap : org.newdawn.slick.Image [6]
13 aload_0 [this]
14 new org.newdawn.slick.Image [3]
17 dup
18 ldc <String "testdata/grass.png"> [7]
20 invokespecial org.newdawn.slick.Image(java.lang.String) [5]
23 putfield org.newdawn.slick.tests.AlphaMapTest.textureMap : org.newdawn.slick.Image [8]
26 aload_1 [container]
27 invokevirtual org.newdawn.slick.GameContainer.getGraphics() : org.newdawn.slick.Graphics [9]
30 getstatic org.newdawn.slick.Color.black : org.newdawn.slick.Color [10]
33 invokevirtual org.newdawn.slick.Graphics.setBackground(org.newdawn.slick.Color) : void [11]
36 return
Line numbers:
[pc: 0, line: 33]
[pc: 13, line: 34]
[pc: 26, line: 35]
[pc: 36, line: 36]
Local variable table:
[pc: 0, pc: 37] local: this index: 0 type: org.newdawn.slick.tests.AlphaMapTest
[pc: 0, pc: 37] local: container index: 1 type: org.newdawn.slick.GameContainer
// Method descriptor #53 (Lorg/newdawn/slick/GameContainer;I)V
// Stack: 0, Locals: 3
public void update(org.newdawn.slick.GameContainer container, int delta) throws org.newdawn.slick.SlickException;
0 return
Line numbers:
[pc: 0, line: 43]
Local variable table:
[pc: 0, pc: 1] local: this index: 0 type: org.newdawn.slick.tests.AlphaMapTest
[pc: 0, pc: 1] local: container index: 1 type: org.newdawn.slick.GameContainer
[pc: 0, pc: 1] local: delta index: 2 type: int
// Method descriptor #57 (Lorg/newdawn/slick/GameContainer;Lorg/newdawn/slick/Graphics;)V
// Stack: 5, Locals: 3
public void render(org.newdawn.slick.GameContainer container, org.newdawn.slick.Graphics g) throws org.newdawn.slick.SlickException;
0 aload_2 [g]
1 invokevirtual org.newdawn.slick.Graphics.clearAlphaMap() : void [12]
4 aload_2 [g]
5 getstatic org.newdawn.slick.Graphics.MODE_NORMAL : int [13]
8 invokevirtual org.newdawn.slick.Graphics.setDrawMode(int) : void [14]
11 aload_0 [this]
12 getfield org.newdawn.slick.tests.AlphaMapTest.textureMap : org.newdawn.slick.Image [8]
15 ldc <Float 10.0> [15]
17 ldc <Float 50.0> [16]
19 invokevirtual org.newdawn.slick.Image.draw(float, float) : void [17]
22 aload_2 [g]
23 getstatic org.newdawn.slick.Color.red : org.newdawn.slick.Color [18]
26 invokevirtual org.newdawn.slick.Graphics.setColor(org.newdawn.slick.Color) : void [19]
29 aload_2 [g]
30 ldc <Float 290.0> [20]
32 ldc <Float 40.0> [21]
34 ldc <Float 200.0> [22]
36 ldc <Float 200.0> [22]
38 invokevirtual org.newdawn.slick.Graphics.fillRect(float, float, float, float) : void [23]
41 aload_2 [g]
42 getstatic org.newdawn.slick.Color.white : org.newdawn.slick.Color [24]
45 invokevirtual org.newdawn.slick.Graphics.setColor(org.newdawn.slick.Color) : void [19]
48 aload_2 [g]
49 getstatic org.newdawn.slick.Graphics.MODE_ALPHA_MAP : int [25]
52 invokevirtual org.newdawn.slick.Graphics.setDrawMode(int) : void [14]
55 aload_0 [this]
56 getfield org.newdawn.slick.tests.AlphaMapTest.alphaMap : org.newdawn.slick.Image [6]
59 ldc <Float 300.0> [26]
61 ldc <Float 50.0> [16]
63 invokevirtual org.newdawn.slick.Image.draw(float, float) : void [17]
66 aload_2 [g]
67 getstatic org.newdawn.slick.Graphics.MODE_ALPHA_BLEND : int [27]
70 invokevirtual org.newdawn.slick.Graphics.setDrawMode(int) : void [14]
73 aload_0 [this]
74 getfield org.newdawn.slick.tests.AlphaMapTest.textureMap : org.newdawn.slick.Image [8]
77 ldc <Float 300.0> [26]
79 ldc <Float 50.0> [16]
81 invokevirtual org.newdawn.slick.Image.draw(float, float) : void [17]
84 aload_2 [g]
85 getstatic org.newdawn.slick.Graphics.MODE_NORMAL : int [13]
88 invokevirtual org.newdawn.slick.Graphics.setDrawMode(int) : void [14]
91 return
Line numbers:
[pc: 0, line: 50]
[pc: 4, line: 51]
[pc: 11, line: 52]
[pc: 22, line: 53]
[pc: 29, line: 54]
[pc: 41, line: 55]
[pc: 48, line: 57]
[pc: 55, line: 58]
[pc: 66, line: 59]
[pc: 73, line: 60]
[pc: 84, line: 61]
[pc: 91, line: 62]
Local variable table:
[pc: 0, pc: 92] local: this index: 0 type: org.newdawn.slick.tests.AlphaMapTest
[pc: 0, pc: 92] local: container index: 1 type: org.newdawn.slick.GameContainer
[pc: 0, pc: 92] local: g index: 2 type: org.newdawn.slick.Graphics
// Method descriptor #61 (IC)V
// Stack: 0, Locals: 3
public void keyPressed(int key, char c);
0 return
Line numbers:
[pc: 0, line: 68]
Local variable table:
[pc: 0, pc: 1] local: this index: 0 type: org.newdawn.slick.tests.AlphaMapTest
[pc: 0, pc: 1] local: key index: 1 type: int
[pc: 0, pc: 1] local: c index: 2 type: char
// Method descriptor #66 ([Ljava/lang/String;)V
// Stack: 4, Locals: 2
public static void main(java.lang.String[] argv);
0 new org.newdawn.slick.AppGameContainer [28]
3 dup
4 new org.newdawn.slick.tests.AlphaMapTest [29]
7 dup
8 invokespecial org.newdawn.slick.tests.AlphaMapTest() [30]
11 invokespecial org.newdawn.slick.AppGameContainer(org.newdawn.slick.Game) [31]
14 astore_1 [container]
15 aload_1 [container]
16 sipush 800
19 sipush 600
22 iconst_0
23 invokevirtual org.newdawn.slick.AppGameContainer.setDisplayMode(int, int, boolean) : void [32]
26 aload_1 [container]
27 invokevirtual org.newdawn.slick.AppGameContainer.start() : void [33]
30 goto 38
33 astore_1 [e]
34 aload_1 [e]
35 invokevirtual org.newdawn.slick.SlickException.printStackTrace() : void [35]
38 return
Exception Table:
[pc: 0, pc: 30] -> 33 when : org.newdawn.slick.SlickException
Line numbers:
[pc: 0, line: 77]
[pc: 15, line: 78]
[pc: 26, line: 79]
[pc: 30, line: 82]
[pc: 33, line: 80]
[pc: 34, line: 81]
[pc: 38, line: 83]
Local variable table:
[pc: 15, pc: 30] local: container index: 1 type: org.newdawn.slick.AppGameContainer
[pc: 34, pc: 38] local: e index: 1 type: org.newdawn.slick.SlickException
[pc: 0, pc: 39] local: argv index: 0 type: java.lang.String[]
}
最佳答案
我遇到了同样的问题,我通过将平铺更改为版本 1.3.2 修复了它
关于java - 错误 : Could not find or load main class org. newdawn.slick.tests.AlphaMapTest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60008651/
我已经使用 vue-cli 两个星期了,直到今天一切正常。我在本地建立这个项目。 https://drive.google.com/open?id=0BwGw1zyyKjW7S3RYWXRaX24tQ
您好,我正在尝试使用 python 库 pytesseract 从图像中提取文本。请找到代码: from PIL import Image from pytesseract import image_
我的错误 /usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference
我已经训练了一个模型,我正在尝试使用 predict函数但它返回以下错误。 Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]])
根据Microsoft DataConnectors的信息我想通过 this ODBC driver 创建一个从 PowerBi 到 PostgreSQL 的连接器使用直接查询。我重用了 Micros
我已经为 SoundManagement 创建了一个包,其中有一个扩展 MediaPlayer 的类。我希望全局控制这个变量。这是我的代码: package soundmanagement; impo
我在Heroku上部署了一个应用程序。我正在使用免费服务。 我经常收到以下错误消息。 PG::Error: ERROR: out of memory 如果刷新浏览器,就可以了。但是随后,它又随机发生
我正在运行 LAMP 服务器,这个 .htaccess 给我一个 500 错误。其作用是过滤关键字并重定向到相应的域名。 Options +FollowSymLinks RewriteEngine
我有两个驱动器 A 和 B。使用 python 脚本,我在“A”驱动器中创建一些文件,并运行 powerscript,该脚本以 1 秒的间隔将驱动器 A 中的所有文件复制到驱动器 B。 我在 powe
下面的函数一直返回这个错误信息。我认为可能是 double_precision 字段类型导致了这种情况,我尝试使用 CAST,但要么不是这样,要么我没有做对...帮助? 这是错误: ERROR: i
这个问题已经有答案了: Syntax error due to using a reserved word as a table or column name in MySQL (1 个回答) 已关闭
我的数据库有这个小问题。 我创建了一个表“articoli”,其中包含商品的品牌、型号和价格。 每篇文章都由一个 id (ID_ARTICOLO)` 定义,它是一个自动递增字段。 好吧,现在当我尝试插
我是新来的。我目前正在 DeVry 在线学习中级 C++ 编程。我们正在使用 C++ Primer Plus 这本书,到目前为止我一直做得很好。我的老师最近向我们扔了一个曲线球。我目前的任务是这样的:
这个问题在这里已经有了答案: What is an undefined reference/unresolved external symbol error and how do I fix it?
我的网站中有一段代码有问题;此错误仅发生在 Internet Explorer 7 中。 我没有在这里发布我所有的 HTML/CSS 标记,而是发布了网站的一个版本 here . 如您所见,我在列中有
如果尝试在 USB 设备上构建 node.js 应用程序时在我的树莓派上使用 npm 时遇到一些问题。 package.json 看起来像这样: { "name" : "node-todo",
在 Python 中,您有 None单例,在某些情况下表现得很奇怪: >>> a = None >>> type(a) >>> isinstance(a,None) Traceback (most
这是我的 build.gradle (Module:app) 文件: apply plugin: 'com.android.application' android { compileSdkV
我是 android 的新手,我的项目刚才编译和运行正常,但在我尝试实现抽屉导航后,它给了我这个错误 FAILURE: Build failed with an exception. What wen
谁能解释一下?我想我正在做一些非常愚蠢的事情,并且急切地等待着启蒙。 我得到这个输出: phpversion() == 7.2.25-1+0~20191128.32+debian8~1.gbp108
我是一名优秀的程序员,十分优秀!