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

Kirito101's Comments

Back to Kirito101's profile

This senses if the character is within 24 pixels of the center of river when facing a direction. If facing to the right it will only block going right. RiverA is my image.Hope this makes sense. There is no doubt a better way of doing this though. I used: public int Direction() { Actor RiverR=getOneObjectAtOffset(24,0,RiverA.class); Actor RiverL=getOneObjectAtOffset(-24,0,RiverA.class); Actor RiverT=getOneObjectAtOffset(0,-25,RiverA.class); Actor RiverB=getOneObjectAtOffset(0,25,RiverA.class); if(Greenfoot.isKeyDown("Up")) { Direction=3; if(RiverT == null) if(speed<=3) speed++; else{ speed=0;setLocation(getX(), getY()-1);} } else if(Greenfoot.isKeyDown("Right")) { Direction=4;//facing right //loop to move 1 square if(RiverR == null) if(speed<=3) speed++; else{ speed=0;move(1);} } else if(Greenfoot.isKeyDown("Left")) { Direction=2; if(RiverL == null) if(speed<=3) speed++; else{ speed=0;move(-1);} } else if(Greenfoot.isKeyDown("Down")) { Direction=1; if(RiverB == null) if(speed<=3) speed++; else{ speed=0;setLocation(getX(), getY()+1);} } return Direction; }
nvm im just silly
somehow got stuck in the 3 card pass hallway...?
Not sure I'm going about this the right way but i'm using your map concept and am struggling with adding an actor. I think it has something to do with the constructor i used but i'm not sure how to fix it. I'm pretty sure I need the constructor to re-size my images.Using other things to re-size them always seems to distort the images.
I will work on trying to fix the blue cars turning. May take a while for me to get it right though as I am still pretty new to Greenfoot.
Sorry about that. I forgot to add instructions.Thanks for your input.
Wow this game is amazing!I like the final fantasy 13 music you out in!
How did you determine what th last key pressed was in order for him to run when you only pressed the button once?