No problem for the help and good job. I don't know why this happens but the movement is very slow, this doesn't happen when I download the scenario, so my only guess is that it could be some kind of performance issue. One last thing is that there is a bug when you jump and land on a platform you sometimes jump through that platform and land in the middle of it.
A new version of this scenario was uploaded on Tue Jul 30 09:03:05 UTC 2013
Build: 1.11
Changelist:
-Fixed World Boundaries -(Attempted) to Make the Detection Better
Thanks, I'm currently working on the UI and collision detection, and you can always click menu up top to go back and respawn, but I will add respawning soon!
A new version of this scenario was uploaded on Tue Jul 30 14:12:00 UTC 2013
Showing Example. Not working atm.
A new version of this scenario was uploaded on Tue Jul 30 14:26:00 UTC 2013
Build: 1.12
Changelog:
-Added Mouse(wip)
-Improved Collision Detection -Added Easter-Egg - Find it!
I think I've found it. But I won't tell here. Can I ask you, if you here?
http://www.greenfoot.org/scenarios/5719
It's a messaging scenario.
You first have to play it, so that you are registered there. If you want to do, then tell me here please.
Once you start my scenario while logged in, you will be registered. Also, I looked and both of you ARE registered. The left and right arrows near the top of the screen allows scrolling through all the registered users.
Thanks Dan, I think Kart is sleeping or is busy. Thanks for you scenario and all your help, once again!
A new version of this scenario was uploaded on Tue Jul 30 21:43:14 UTC 2013
Build: 1.13
Changelog:
-Finished Cursor
-Added Intro
-Improved the Graphics
*Give me feed-back on the background color and tell me if you find the easter egg. Here is a hint: 'power'.
I've recently created a physics scenario that simulates gravity using a bouncing ball. I made collision detection for it that is 100% incapable of glitching into things (to my knowledge). You should take a look!
http://www.greenfoot.org/scenarios/9172
Also, here is the code (to save you some trouble)!
[code]
import greenfoot.*;
public class Ball extends Actor
{
int xmove=0;
int ymove=0;
boolean shadowImagery=false;
boolean sdown=false;
boolean gdown=false;
public void act()
{
//Shadow Imagery Cheat
if (Greenfoot.isKeyDown("s")&&sdown==false){
if (shadowImagery==false){shadowImagery=true;}else{shadowImagery=false;}
sdown=true;
}else if (! Greenfoot.isKeyDown("s")){sdown=false;}
if (shadowImagery==true)getWorld().addObject(new Shadow(getImage()),getX(),getY());
//Zero Gravity Cheat
if (Greenfoot.isKeyDown("g")&&gdown==false){
if (gravity==true){gravity=false;}else{gravity=true;}
gdown=true;
}else if (! Greenfoot.isKeyDown("g")){gdown=false;}
//Method Calls
grab();
physics();
}
public void grab(){
MouseInfo mouse = Greenfoot.getMouseInfo();
if (mouse==null)return;
if (mouse.getButton()>0){
if (mouse.getButton()==1){
if (getX()>mouse.getX()){xmove--;}
if (getX()<mouse.getX()){xmove++;}
if (getY()>mouse.getY()){ymove--;}
if (getY()<mouse.getY()){ymove++;}
}
}
}
/**Copy everything between this blue comment and the next one to apply
physics to an object (I will eventually apply elasticity properties so
it is more realistic)*/
int gravityTimeRateMax = 3; //Amount of cycles until speed increases
int gravityTimeRate = gravityTimeRateMax;
int frictionAmountMax = 300; //How many cycles until the object slows
//down due to friction
int xFrictionAmount=0;
int yFrictoinAmount=0;
boolean gravity = true; //Just in case you want to switch gravity ;D
Class[] objects = {Ball.class,Box.class}; //All objects that can be collided with
public void gravity(boolean g){gravity=g;}
public void physics(){
boolean ground = false;
int collisionAmount=0;
boolean xhold=false;
boolean yhold=false;
//Collision detection
while (collisionAmount<objects.length){
//Down check
for (int i=-getImage().getWidth()/2+4; i<getImage().getWidth()/2-4; i+=4){
Actor object = getOneObjectAtOffset(i, getImage().getHeight()/2+2+ymove,objects[collisionAmount]);
if (object!=null&&ymove>=0){yhold=true; ground = true; ymove=-ymove/2; setLocation(getX(),object.getY()-object.getImage().getHeight()/2-getImage().getHeight()/2); break;}
}
//Up check
for (int i=-getImage().getWidth()/2+4; i<getImage().getWidth()/2-4; i+=4){
Actor object = getOneObjectAtOffset(i, -getImage().getHeight()/2-3+ymove,objects[collisionAmount]);
if (object!=null&&ymove<=0){yhold=true; ymove=-ymove/2; setLocation(getX(),object.getY()+object.getImage().getHeight()/2+getImage().getHeight()/2); break;}
}
//Left check
for (int i=-getImage().getHeight()/2+4; i<getImage().getHeight()/2-4; i+=4){
Actor object = getOneObjectAtOffset(0-getImage().getWidth()/2-3+xmove, i,objects[collisionAmount]);
if (object!=null&&xmove<=0){xhold=true; xmove=-xmove/2; setLocation(object.getX()+object.getImage().getWidth()/2+getImage().getWidth()/2,getY()); break;}
}
//Right check
for (int i=-getImage().getHeight()/2+4; i<getImage().getHeight()/2-4; i+=4){
Actor object = getOneObjectAtOffset(getImage().getWidth()/2+2+xmove, i,objects[collisionAmount]);
if (object!=null&&xmove>=0){xhold=true; xmove=-xmove/2; setLocation(object.getX()-object.getImage().getWidth()/2-getImage().getWidth()/2,getY()); break;}
}
collisionAmount++;
}
//Gravity
if (ground==false&&gravity==true){
if (gravityTimeRate==0){
gravityTimeRate=gravityTimeRateMax;
ymove++;
}else{
gravityTimeRate--;
}
}else{gravityTimeRate=gravityTimeRateMax;}
//Friction
if (ground==true&&xFrictionAmount<frictionAmountMax&&xmove!=0){
xFrictionAmount++;
}
if (xFrictionAmount==frictionAmountMax||xmove==0){
xFrictionAmount=0;
if (xmove>0)xmove--;
if (xmove<0)xmove++;
}
//Move commands
if (xhold==false)setLocation(getX()+xmove,getY());
if (yhold==false)setLocation(getX(),getY()+ymove);
}
/**End of code (don't forget to call the "physics" method)!*/
}
[/code]
2013/7/29
2013/7/29
2013/7/30
2013/7/30
2013/7/30
2013/7/30
2013/7/30
2013/7/30
2013/7/30
2013/7/30
2013/7/30
2013/7/30
2013/7/30
2013/7/30
2013/7/30
2013/7/31
2013/7/31
2013/8/1
2013/8/1
2013/8/3
2013/8/8
2013/8/9
2013/8/9