gridworld

How to move a Bug in GridWorld with arrow keys

ぐ巨炮叔叔 提交于 2019-12-21 20:58:52
问题 I'm making a game for my computer Science class and I am trying to move a character object that extends Bug with the arrow keys. Should I put the code to move with the arrow keys in the Character class or in the World class? And what should the code look like? Right now I've got this code in the Character class and it complies fine, but when I try to to run it in the grid nothing happens when I press the arrow keys. public class Character extends Bug { Random pokemon; public Character() { }

Changing the Gridpanel class in Gridworld

元气小坏坏 提交于 2019-12-13 06:41:16
问题 I am trying to follow the steps to change the Gridworld appearance according to this. I've already imported source code for my gridworld jar file; ie. I can go and look at Bug.class or Gridpanel.class if I wanted to. However, I can't edit these files to produce the results that that pdf suggests. How do I do this? Did I import the source code incorrectly? 回答1: I don't think you can edit an external resource like gridworld.jar. You are going to need to create 4 new packages: actor grid gui

How to move a Bug in GridWorld with arrow keys

荒凉一梦 提交于 2019-12-04 17:20:00
I'm making a game for my computer Science class and I am trying to move a character object that extends Bug with the arrow keys. Should I put the code to move with the arrow keys in the Character class or in the World class? And what should the code look like? Right now I've got this code in the Character class and it complies fine, but when I try to to run it in the grid nothing happens when I press the arrow keys. public class Character extends Bug { Random pokemon; public Character() { } public void act(KeyEvent e) { move(e); pokemon = new Random(); if(pokemon.nextInt(10) == 5) System.out