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

2020/1/11

Saving the world moves objects

Tietie12 Tietie12

2020/1/11

#
when i save the world after adding a new object such as in this case when i add a new platform for my game and then save the world it will move it from where i placed it and not line up with any of the others. does anyone know how you can solve this issue or what might me cause it? thanks for any of the help. ps, i have used greenfoot at my school (they use an older version) and have never had the issue but when i downloaded the newest version at home i have had this issue.
danpost danpost

2020/1/11

#
Q: what are the dimensions of your world? Q: where are you trying to place the platform? Q: where is this platform ending up at? Please show your prepare method.
Tietie12 Tietie12

2020/1/12

#
the dimensions are 800 by 800 by 1 i am trying to place the platform anywhere on the level im just trying to get it to work but it seems so work somtimes and sometimes not i will also post the prepare method shortly i now realized what you meant by where, i will make a new object and tell you where i wanted it and where it ends up
Tietie12 Tietie12

2020/1/12

#
so i want to place the platform at 308 , 337 and it ends up at 308 , 344 it seems so be random where it moves and how much and ill attach the prepare code below. also if it matters the version my school is running is 3.0.0 and im using 3.6.1 apart from graphical changes it seems they are close to the same apart from just minor changes ive noticed
private void prepare()
    {

        Platforms platforms = new Platforms();
        addObject(platforms,308,344);
        
    }
im not sure as to why it is setting the co-ordinates to somewhere else than where i drag and dropped it into the world. (p.s. ive seen about a couple hundreds of posts where you helped out you are a true chad :P)
danpost danpost

2020/1/12

#
Did you know that, before you save the world, you can drag the actor to your location of choice (even after placing it to begin with)? Or, you can edit the code in your prepare method to have it placed into the world at the exact location you want.
Tietie12 Tietie12

2020/1/12

#
yes when i drag an object to where i want it and save the world it moves away from where i placed it and it is changed in the prepare method i know it is possible to continue with this method but it makes it incredibly slow opposed to not having too
KylesGallery KylesGallery

2020/1/15

#
if you get rid of setLocation in MyWorld() that's probably going to be the place closest to the original location, and if a different actor has moved getting rid of the setLocation for that actor will put the actor back to where it originally was
Don't know if it helps now but.... I had this same problem before. What I had to do was delete all of the actors code from the world, then delete the class, then just remake it... I don't know if there is a much more easy way but this is how I did it. One of my friends also had this problem but he deleted all the world code, then just replaced every actor.
danpost danpost

2020/1/22

#
Tietie12 wrote...
i know it is possible to continue with this method but it makes it incredibly slow opposed to not having too
Makes what slow -- the running of the scenario or the coding of it?
You need to login to post a reply.