Nice images!
It'll lag if you set the image for each letter dynamically each time, yes - as for why it's not working when the letters reach the end of the screen, you'll need to upload the source if you want people to help you fix it!
no.... if the letters reach the end of the screen... then you lose... the game end ^^!
are there anything i can do with the images to make it less lag... cause it wok fine on my computer
The game may indeed end, but that doesn't change the fact that there's a problem with it! I'm getting the following when letters reach the other side of the screen:
java.lang.StackOverflowError
at java.lang.Math.floor(Unknown Source)
at greenfoot.Actor.getPaintX(Actor.java:510)
at greenfoot.Actor.getXMax(Actor.java:475)
at greenfoot.Actor.getWidth(Actor.java:167)
at greenfoot.Actor.intersects(Actor.java:630)
at greenfoot.ActorVisitor.intersects(ActorVisitor.java:30)
at greenfoot.collision.GOCollisionQuery.checkCollision(GOCollisionQuery.java:40)
at greenfoot.collision.ibsp.IBSPColChecker.checkForOneCollision(IBSPColChecker.java:755)
at greenfoot.collision.ibsp.IBSPColChecker.getOneObjectDownTree(IBSPColChecker.java:786)
at greenfoot.collision.ibsp.IBSPColChecker.getOneIntersectingObject(IBSPColChecker.java:1070)
at greenfoot.World.getOneIntersectingObject(World.java:731)
at greenfoot.Actor.getOneIntersectingObject(Actor.java:751)
at bar.stopSimulation24(bar.java:419)
at bar.stopSimulation24(bar.java:425)
at bar.stopSimulation24(bar.java:425)
at bar.stopSimulation24(bar.java:425)
at bar.stopSimulation24(bar.java:425)
at bar.stopSimulation24(bar.java:425)
The images will probably work fine on your computer because it'll take next to no time to load them, on the gallery it's different. You can declare them as static fields instead at the top of your class, and then just reference the images from there - that should reduce the lag a lot.
In terms of the gameplay, you might also want to start off a bit slower - I wouldn't say I'm a slow typer but I'm struggling to get more than 20! (Or perhaps I am just a slow typer...) some of the letters also sometimes appear a bit off the bottom of the screen, so you might want to put some more code in to prevent that happening (it makes it hard to see what they are.)
ok that i can fit,
when i use the method atEdgeDisappear()
if (atWorldEdge() == true)
>getWorld().removeObject(this);
it crash when i play...
so i have to make like a bar.. and set it at the left edge.
and use the checkCollision() method to end the game....
i will try to declare them as static fileds ^^!
thank for your help
Just declare them as normal fields, but put static in the declaration. You may also want final in there (this stops them being changed.) So it'd be something like:
public static final GreenfootImage imageA = new GreenfootImage("images/a.png");
Note that if fields are constants (final), it's ok to have them as public.
Just thought I'd jump in there quickly because yes, fields should usually always be private - this is the one exception where it's ok to do otherwise!
so i create a class but do not set the image (Ex: a, b, c, d...)
than create another class (display...)
public static final GreenfootImage imageA = new GreenfootImage("a.png");
than on the act method
setImage(imageA);//this will display the image??
You don't need to create another class, just declare the fields at the top of your existing class. Then as you said it's just a case of calling setImage to display the image you want.
When images are created statically they're only created once per class, not once per instance of that class - and in this case that means they're only loaded once, not once for every letter that's created. That's probably what's happening with them at the moment, hence the lag!
A new version of this scenario was uploaded on Sun May 31 00:43:17 UTC 2009
A new version of this scenario was uploaded on Sun May 31 00:44:20 UTC 2009
i remove the image of the class.... and now it not lag.. but it stop in the middle of the game ...
can u check to see what the error is ?
cause nothing happen in my computer
A new version of this scenario was uploaded on Sun May 31 01:14:04 UTC 2009
A new version of this scenario was uploaded on Sun May 31 18:54:21 UTC 2009
A new version of this scenario was uploaded on Sun May 31 19:03:39 UTC 2009
Ah, you seem to have solved the error :-) The levels work nicely, though the hardest is pretty impossible! Also, the game over screen appears immediately so you can't see your score - any chance of changing that?
A new version of this scenario was uploaded on Sun May 31 23:47:14 UTC 2009
2009/5/30
2009/5/30
2009/5/30
2009/5/30
2009/5/30
2009/5/30
2009/5/30
2009/5/30
2009/5/31
2009/5/31
2009/5/31
2009/5/31
2009/5/31
2009/5/31
2009/5/31
2009/5/31
2009/5/31
2009/5/31
2009/6/1