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

2019/2/2

I've been working on a project in greenfoot and i need help on Character selection.

1
2
3
danpost danpost

2019/2/3

#
SniperRocks wrote...
i meant arenaone not maps, i apologize. But yeah it works on selection but how can i make it work to show up on arenaone
Change line 49 in the selection class to:
Greenfoot.setWorld(new Arenaone());
SniperRocks SniperRocks

2019/2/4

#
It still doesnt show up in arenaone, the players dont. I click on the characters it does go from selection to arenaone but it doesnt show the players in arenaone.
danpost danpost

2019/2/4

#
I do not see where you are acquiring the chosen characer:
danpost wrote...
The map Arenaone world will have to get the character:
Actor player = selection.player;
SniperRocks SniperRocks

2019/2/5

#
Oh i am sorry for wasting your time, i didnt know my partner finished our sprint. If i were to have any other questions (which is most likely going to happen soon) should i make a new discuss page or stick with this one?
danpost danpost

2019/2/5

#
SniperRocks wrote...
Oh i am sorry for wasting your time, i didnt know my partner finished our sprint. If i were to have any other questions (which is most likely going to happen soon) should i make a new discuss page or stick with this one?
Unless it is about the selection process, you should start a new one.
SniperRocks SniperRocks

2019/2/5

#
alright, thanks! i love you bro no homo
SniperRocks SniperRocks

2019/2/14

#
Alright since im back to task, heres what ive done so far. I made music stop when entering world and about character selection it is still in progress, so i need help when clicking onto the character i want it to appear on arenaone but what you gave me did not work so do you have any other suggestions?
danpost danpost

2019/2/14

#
SniperRocks wrote...
i need help when clicking onto the character i want it to appear on arenaone but what you gave me did not work so do you have any other suggestions?
Please show your Arenaone class code and indicate which actor in it the selection process is supposed to set.
SniperRocks SniperRocks

2019/2/16

#
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) /** * Write a description of class MyWorld here. * * @author (your name) * @version (a version number or a date) */ public class Arenaone extends World { private PlayerEntity playerone; private PlayerEntitytwo playertwo; private ironman iron; private hulkk hu; private Timer timer; private int Timer = 0; GreenfootSound bm = new GreenfootSound("battleone.mp3"); // private Bar healthBar; // GreenfootSound punch = new GreenfootSound("ipunch.mp3"); Actor player = selection.playerone; public Arenaone() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(711, 400, 1); // playerone = new PlayerEntity(playerone.class); // addObject(playerone, 123, 268); iron = new ironman(); addObject(iron, 123, 268); // playertwo = new PlayerEntitytwo(playertwo.class); // addObject(playertwo, 545, 267); hu = new hulkk(); addObject(hu, 539, 237); timer = new Timer(); addObject(timer, 322, 50); addStones(); MusicManager.stopscreen(); // MusicManager.arenaone(); // if(timer>0) // { // timer -- ; // if(timer == 0) // Greenfoot.stop(); // } // Label pHealth = captain.getHealthLabel(); // pHealth.setLocation( 597,50 ); // healthBar = new Bar("", "Health", 100, 100); // healthBar.setTextColor(Color.white); // addObject(healthBar, 100, 30); // hulk = new PlayerEntity(hulk.class); // addObject(hulk, 123, 268); // backgroundMusic.playLoop(); } public void addStones() { for(int i = 0; i < 30; i++) { Stone floor = new Stone(); addObject(floor, 0 + (i * floor.getImage().getWidth()) , 351); } } }
danpost danpost

2019/2/16

#
Your player acquiring line does not look like what I gave above and the line to add the actor into the world is commented out.
SniperRocks SniperRocks

2019/2/18

#
oh my bad, i commented the actor out because i was working on something else and didnt want the actor involved to mess it up.
SniperRocks SniperRocks

2019/2/18

#
public class Arenaone extends World { private PlayerEntity playerone; private PlayerEntitytwo playertwo; private Timer timer; GreenfootSound bm = new GreenfootSound("battleone.mp3"); // GreenfootSound punch = new GreenfootSound("ipunch.mp3"); Actor player = selection.playerone; public Arenaone() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(711, 400, 1); playerone = new PlayerEntity(playerone.class); addObject(playerone, 123, 268); playertwo = new PlayerEntitytwo(playertwo.class); addObject(playertwo, 545, 267); timer = new Timer(); addObject(timer, 322, 50); addStones(); MusicManager.stopscreen(); // MusicManager.arenaone(); } public void addStones() { for(int i = 0; i < 30; i++) { Stone floor = new Stone(); addObject(floor, 0 + (i * floor.getImage().getWidth()) , 351); } } }
SniperRocks SniperRocks

2019/2/18

#
is this wrong? did i put the actor player = selection.playerone wrong? i apologize because im not good with coding as much.
danpost danpost

2019/2/18

#
SniperRocks wrote...
is this wrong? did i put the actor player = selection.playerone wrong? i apologize because im not good with coding as much.
I believe I named the field in the selection class as player, not playerone.
SniperRocks SniperRocks

2019/2/18

#
public class selection extends World { /** * Constructor for objects of class selection. * */ Actor player = selection.playerone; public static Actor playerone; public Actor icons; GreenfootSound backgroundMusic = new GreenfootSound("lockdownone.mp3"); public selection() { // Create a new world with 600x400 cells with a cell size of 1x1 pixels. super(711, 400, 1); prepare(); } private void prepare() { GreenfootImage images = { (new ironman()).getImage(), (new captain()).getImage(), (new blackpanther()).getImage(), (new hulk()).getImage() }; icons = new Actor; for (int i=0; i<images.length; i++) { icons = new SimpleActor(); icons.setImage(images); addObject(icons, 122+155*i, 200); //getImage().setTransparency(0); } } public void act() { if (!Greenfoot.mouseClicked(null)) return; int selected = -1; for (int i=0; i<icons.length; i++) { if (Greenfoot.mouseClicked(icons)) { selected = i; break; } } if (selected != -1) { switch (selected) { case 0: playerone = new ironman(); break; case 1: playerone = new captain(); break; case 2: playerone = new blackpanther(); break; case 3: playerone = new hulk(); break; } } Greenfoot.setWorld(new map()); } }
There are more replies on the next page.
1
2
3