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

Comments for Typing Game

Return to Typing Game

A new version of this scenario was uploaded on Sat May 30 16:12:25 UTC 2009
A new version of this scenario was uploaded on Sat May 30 16:17:15 UTC 2009
dannymaster92dannymaster92

2009/5/30

Why it don't have the speed control, and it so lag.... it work fine on my comp... sorry i'm new
A new version of this scenario was uploaded on Sat May 30 18:14:23 UTC 2009
A new version of this scenario was uploaded on Sat May 30 18:40:18 UTC 2009
A new version of this scenario was uploaded on Sat May 30 18:42:09 UTC 2009
A new version of this scenario was uploaded on Sat May 30 19:02:39 UTC 2009
dannymaster92dannymaster92

2009/5/30

can't somone fix it... it kind of lag... but it work fine in my computer
dannymaster92dannymaster92

2009/5/30

it lag because i set the image (.png) for each letter?
mjrb4mjrb4

2009/5/30

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!
dannymaster92dannymaster92

2009/5/30

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
mjrb4mjrb4

2009/5/30

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.
mjrb4mjrb4

2009/5/30

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.)
dannymaster92dannymaster92

2009/5/30

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
mjrb4mjrb4

2009/5/31

The atWorldEdge method shouldn't cause any errors if you haven't modified it from the mover class - what error are you getting?
dannymaster92dannymaster92

2009/5/31

can u show me how to declare the image as static fields
mjrb4mjrb4

2009/5/31

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");
mjrb4mjrb4

2009/5/31

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!
dannymaster92dannymaster92

2009/5/31

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??
mjrb4mjrb4

2009/5/31

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
dannymaster92dannymaster92

2009/5/31

it still lag... did i have to like remove the image ( create the letter class with no image) or what ?
A new version of this scenario was uploaded on Sun May 31 01:07:36 UTC 2009
dannymaster92dannymaster92

2009/5/31

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
dannymaster92dannymaster92

2009/5/31

i has add some lv, but it stop while play .... ? it work good, and no error in my computer... can some one check what the error with this applet
A new version of this scenario was uploaded on Sun May 31 22:59:53 UTC 2009
A new version of this scenario was uploaded on Sun May 31 23:03:02 UTC 2009
A new version of this scenario was uploaded on Sun May 31 23:10:16 UTC 2009
mjrb4mjrb4

2009/5/31

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
ah... i make the color red so u can see it ^^!
A new version of this scenario was uploaded on Thu Oct 07 16:10:58 UTC 2010