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

2012/12/7

How to make a scrolling background wall

KierTulp KierTulp

2012/12/7

#
Hello everyone, I am having a problem with my code for the "UMAN THE ROBOT" game. I am using a scrolling background to make it look like he is walking, but my walls are not working because of that. If anyone knows how to make a wall when using scrolling background please tell me. I would like to show you the code, but i have no idea on what i need to show you. http://www.greenfoot.org/scenarios/6895 there's a link to my scenario. thanks in advance.
vonmeth vonmeth

2012/12/7

#
You'll need to make your scenario source available. It currently is not.
danpost danpost

2012/12/7

#
Re-'Share' your scenario, except this time make sure the 'Publish source code' checkbox is checked.
KierTulp KierTulp

2012/12/8

#
whoops... http://www.greenfoot.org/scenarios/6895 here is the link again. Also, i am not the most advanced coder in the world, and i am running on tutorials, the forums and applying things that i have seen before. Altho i must say that i am starting to learn, I still don't think that i will understand some of the more advanced solutions, Please keep that in mind.
danpost danpost

2012/12/8

#
I found that if I built a wall on the left or right side, that when uman contacts it, the blocks he contacts will move against the uman, pushing him back across the screen (then uman seems to disappear). Anyway, real easy fix: remove collision-checking from the WallLinks and WallRechts classes (it is already taken care of in the uman class).
danpost danpost

2012/12/8

#
If you are having problems placing the walls in your world because they are to be somewhere outside the viewing area, add them to the world in view and then edit the code to put them where you want them. For example: if the code produced was:
WallLinks wallLinks = new WallLinks();
addObject(wallLinks, 25, 365);
then you can edit to '25' to '-21' (or whatever) to produce
addObject(wallLinks, -21, 365);
and the wall will be placed just where you want it.
KierTulp KierTulp

2012/12/8

#
I just looked back at what I send earlier and i see that i havn't been clear enough, my actual problem is that when i keep the right key pressed, my player will stop, but the background will keep scrolling. I am looking for a way to make the background stop scrolling when my player hits a wall. thanks for the second tip btw, I was not really sure on how to make levels yet, altho I am not yet making levels with that tactic it will all go a lot easier!
You need to login to post a reply.