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

2 days ago

help

SanjiNaha SanjiNaha

2 days ago

#
How should i make my actor, who is from a fighting game not go through the screen
danpost danpost

2 days ago

#
SanjiNaha wrote...
How should i make my actor, who is from a fighting game not go through the screen
"through the screen"? Elaborate, please.
KylesGallery KylesGallery

yesterday

#
Try this, and and create an if in your code where it detects if atEdge==true then do the opposite movement back public boolean atEdge() { if (getX() <= *half size of actor's width* || getX() >= getWorld() . getWidth() -*half size of actor's width*) return true; if (getY() <= *half size of actor's height* || getY() >= getWorld() . getHeight() -*half size of actor's height*) return true; else return false; } This will even work if your world has objects that spawn outside the area you can view in the screen.
SanjiNaha SanjiNaha

yesterday

#
the thing is that i have a fighting game and when the character jumps he goes through the screen
danpost danpost

yesterday

#
SanjiNaha wrote...
the thing is that i have a fighting game and when the character jumps he goes through the screen
Sounds like you need an extra condition placed on when to jump.
You need to login to post a reply.