This site requires JavaScript, please enable it in your browser!
Greenfoot back
supermagicmilk

supermagicmilk

Welcome to my page

supermagicmilk's collections

This user has no collections

Recent Comments | Show All

What awesomeNameGuy said will work, but it will require you to keep track of floating point coordinates separately, which can be kind of a pain, especially when you're going to deal with collisions. You could also put a timer in your world class (a public int) that increments every time the act function for the world is called, then you can implement delays in movement for any actor you want easily. So for the act function of Jumpman, you could have: public void act(){ if( ((NameOfYourWorld)getWorld()).timer % delay != 0 ){return;} // your act code } Then you can increase the "delay" value to slow the movement speed down and still use the int coordinates built into the actor class.
supermagicmilk

2011/8/26

a) red b) blue c) yellow d) green Also, to be able to read in dynamic equations, there are several routes you could go. One is to build a simple parser for the the input (which would not be very simple to code probably). The other that I can think of is to implement a drag and drop interface for math operations so that you know for certain what has been entered. For example, to add two expressions, you could have a icon to drag in that has two placeholders for the expressions on either side of the "+" symbol, kind of like so: 2x == () * () -> (2) * (x) 2(x+1) == () * (() + ()) -> (2) * ((x)+(1)) That way, you know what the equation parses to in advance because you force it to behave that way. The other way I can think of, and probably the easiest is to implement is a parser that uses prefix, function notation. So your equation c for example could be written like so: subtract( sqrt( abs( mult(x,10) ) ) , 10 ); Of course, that looks a bit messier, but it's one of the easier ways to do it. I hope this was helpful.