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

2020/1/14

help

SanjiNaha SanjiNaha

2020/1/14

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

2020/1/15

#
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

2020/1/15

#
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

2020/1/15

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

2020/1/16

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