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

2017/2/10

Help in making a platformer game?

haynako haynako

2017/2/10

#
So, I'm making a platformer game and I 'm having all sorts of trouble with it. If you know the codes to my concerns below, please tell me asap! I'm a beginner at this, sorry! About platforms: 1. How do I make objects spawn from the edge of the screen but at different Y coordinates each time? 2. How do I make these objects spawn one by one, for example, 3 seconds after the first object appeared? 3. How do I make these objects into 'platforms' were my actor can land on them from jumping and not fall through? 4. How do I make the 'starting' platform stay put until the actor jumps off of it before moving? About the actor: 1. Is there a way where I can make the actor jump in an angle? 2. How do I make the actor move with the platform when it lands on it? About the coin that's supposed to be above the platforms: 1. How do I make the coin move with the platforms? 2. How do I make it disappear when the actor touches it and add a point to a score counter?
davmac davmac

2017/2/10

#
That's a lot of questions! I would suggest you tackle these one at a time. Asking so many questions in one discussion is probably going to lead to a lot of confusion. Some general advice is available {here}, you should read it as it will guide you in how to think about each of your questions and ask for help appropriately. One of the most important things is often to post your code. For your question (1), for example, are you able to have objects spawn at the same location each time? What code do you have for that? If you post it, people will be able to suggest how to alter it to make the objects spawn at a different location.
valdes valdes

2017/2/10

#
Check out this game made by my student Jumper You can download the code. Has platforms, jumping in angle, objects spawning, objects dissapearing when touched...
Nosson1459 Nosson1459

2017/2/10

#
haynako wrote...
1. How do I make objects spawn from the edge of the screen but at different Y coordinates each time?
I made a platformer called pengu (here) and the way I did it was, 1st in the constructor of the world instead of
1
super(500,500,1);
do
1
super(500,500,1,false);
the numbers I put in are irrelevant but putting the keyword false allows you to put objects outside the limits of the world (i.e. your world is 500 pixels by 500 pixels you could put an object at (600,600) or at any negative number(-1,-1) without any problem, so the way I did it was I made a method for each level and preset it up with the whole level (with each platform at a further y coordinate) and as your character "moves to the right" all the platforms are really moving to the left because there is a line of code in each platform that moves it left so it looks like your character is moving right
Nosson1459 Nosson1459

2017/2/12

#
Is there a way that I could have found the above link (here) on my own, because I have never saw it before until now and it would have helped me (I'm also wondering if there are other things there that I haven't seen).
You need to login to post a reply.