// Velocity init public static void initVelocity() { if (velocityCatch == null) { System.out.println("init VM"); velocityCatch = new Object(); Properties props = new Properties(); props.setProperty("input.encoding", "UTF-8"); props.setProperty("output.encoding", "UTF-8"); if (getConfig().getChild("vmtemplatepath") != null) { props.setProperty("file.resource.loader.path", getConfig().getChildText("vmtemplatepath")); } if (System.getProperty("vmtemplatepath") != null) { props.setProperty("file.resource.loader.path", System.getProperty("vmtemplatepath")); // Velocity.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, // System.getProperty("vmtemplatepath"));//oder new FIle()? } System.out.println("vmtemplatepath=" + props.getProperty("vmtemplatepath")); try { Velocity.setProperty(Velocity.RUNTIME_LOG_LOGSYSTEM, VeloLog.getInstance()); Velocity.init(props); } catch (Exception ex) { ex.printStackTrace(); } } }
public void tick(Velocity v) { int dx = (int) (MathUtilities.cosdeg(v.direction) * v.getSpeed()); int dy = (int) (MathUtilities.sindeg(360 - v.direction) * v.getSpeed()); this.x += dx; this.y += dy; }