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

2020/12/1

Teleporting

Programnoob207 Programnoob207

2020/12/1

#
I want to make an object move to (0,0). I am really new to greenfoot and i basically dont know anything about writing codes. As soon the object hits the end of the screen, on the left and right side, it needs to teleport to (0,0). When the teleporting object hits another object during the game, the game needs to freeze. After two seconds, the object needs to teleport to (0,0). Can anyone help? I am trying to recreate the classic game pong. The object that needs to teleport is the ball. The objects that the bal can hit, are the wite bars on the side.
danpost danpost

2020/12/1

#
1
setLocation(0, 0);
will place the object at (0, 0). However, at that location, it is touching the left edge, which may conflict with the scoring.
Programnoob207 Programnoob207

2020/12/1

#
Can you give me some more codes please? Btw, thanks for helping.
danpost danpost

2020/12/1

#
Programnoob207 wrote...
Can you give me some more codes please? Btw, thanks for helping.
It might help if you go over what methods are available in the different classes provided by greenfoot. You can find them here. Start with the World and Actor classes (for now).
You need to login to post a reply.