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

2016/8/23

how to kill my character if it touches the edge of the stage

NAMYA0303 NAMYA0303

2016/8/23

#
hello guys , i am making a game and i want that my rocket crashes when it touches thee edge of the world/stage i want to show my game to my computer teacher and she has a period with me tomorrow so pls fast
danpost danpost

2016/8/23

#
There are Actor class methods 'atWorldEdge' and 'getWorld' with the World class method 'removeObject' that you can use. If adding an explosion animation at the point of edge contact, get the 'X' and 'Y' of the actor before removing it so you can add the explosion at that location..
NAMYA0303 NAMYA0303

2016/8/24

#
can u make a code with the actor name "rocket" as i cant find any at world edge or get world options in th menu which we get by pressing ctrl+spacebar
NAMYA0303 NAMYA0303

2016/8/24

#
danpost is making game ur profession??
NAMYA0303 NAMYA0303

2016/8/24

#
pls help me in this
Super_Hippo Super_Hippo

2016/8/24

#
1
if (atEdge()) getWorld().removeObject(this);
NAMYA0303 NAMYA0303

2016/8/25

#
do we have to make another public void or something like that to type it???
Super_Hippo Super_Hippo

2016/8/25

#
You can put that to the end of the act-method.
NAMYA0303 NAMYA0303

2016/8/25

#
thnx hippo u rock!!!!!!!!
danpost danpost

2016/8/26

#
NAMYA0303 wrote...
danpost is making game ur profession??
No. Programming is a hobby.
1
if (atEdge()) getWorld().removeObject(this);
'atEdge' should be 'isAtEdge', here.
NAMYA0303 NAMYA0303

2016/8/26

#
yeah even i realized it and corrected it yesterday only
NAMYA0303 NAMYA0303

2016/8/26

#
danpost can u check my game before i post it on the website???
NAMYA0303 NAMYA0303

2016/8/26

#
if yes pls give me ur email id
ProfAvi ProfAvi

2016/8/26

#
if (atEdge()) getWorld().removeObject(this);
You need to login to post a reply.