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

2015/11/6

Scenario not playing.

Paulsmlim Paulsmlim

2015/11/6

#
Hello I uploaded a scenario on this website but whenever I play it, it doesn't run properly. The images don't load, and the character does not show up. Is there anything that I'm doing wrong that is preventing me from running this scenario? Scenario I am using Firefox, since Google Chrome does not support JAVA
davmac davmac

2015/11/6

#
When I run your scenario online, I get this stack trace: java.lang.RuntimeException: The specified gif file doesn't exist. at GifImage$GifDecoder.read(GifImage.java:501) at GifImage.loadImages(GifImage.java:115) at GifImage.<init>(GifImage.java:48) at MagicPortal.<init>(MagicPortal.java:12) at JavaRoom.prepare(JavaRoom.java:45) at JavaRoom.<init>(JavaRoom.java:21) That stack trace correlates with the GifImage class included with Greenfoot 2.3.0 (or earlier). I suggest you use a more recent version of the GifImage class, for a start.
Paulsmlim Paulsmlim

2015/11/7

#
Thank you for your response davmac. I created a gif in my scenario by importing the GifImage class. If this is what prevents the website from running my scenario properly, could you tell me where I can find the more recent version of the GifImage class? Thank you.
davmac davmac

2015/11/7

#
Sorry if I wasn't clear - the GifImage class has been updated since Greenfoot 2.3.0, so to get a more recent version of the GifImage class, start by using a more recent version of Greenfoot (the most recent is version 3.0, but you could also use 2.4.2). Delete the current GifImage class and then re-import it from within the newer Greenfoot version.
Paulsmlim Paulsmlim

2015/11/8

#
Thanks for solving this problem for me davmac. Although the all the images are properly showing up on the scenario, the codes that require keys to be pressed are not functioning properly. For example, whenever I press "E", the scenario does not pick it up and does not do what it is supposed to do. Is it supposed to be like this or is there another mistake in my program that is causing this problem?
davmac davmac

2015/11/8

#
I don't know; you didn't upload the source code for your scenario. (It would be better anyway to post the relevant parts of the code here in the forum). (see the guidelines for posting code).
Paulsmlim Paulsmlim

2015/11/8

#
if(Greenfoot.isKeyDown("right")){
                moveRight();
            }
            //Makes Paul move in the left direction whenever the "left" key is pressed
            else if(Greenfoot.isKeyDown("left")){
                moveLeft();
            }
            else{
                if(isWalking){
                    imageNum = 1;
                    isWalking = false;
                }
                //Makes Paul shoot his web bolt whenever the "w" key is pressed
                if(Greenfoot.isKeyDown("w")){
                    if(!inAir){
                        shootWeb();
                    }
                }
                //Makes Paul attacks whenever the "e" key is pressed
                else if(Greenfoot.isKeyDown("e")){
                    if(!inAir){
                        attack();
                    }
                }
                //If none of the keys are pressed, Paul remains standing idle
                else if(!inAir){
                    standing();
                }
            }
The methods that I am using are simple isKeyDown() methods. For my scenario, the spiderman is supposed to attack whenever the user holds E, and shoot webs whenever the user presses W. However, it does not work as intended when I run the scenario online.
davmac davmac

2015/11/10

#
They seem to work fine for me. They don't work when you're moving, is that what you mean?
Paulsmlim Paulsmlim

2015/11/10

#
Yes davmac I think that is the problem. Is there an easy way to fix this problem?
Paulsmlim Paulsmlim

2015/11/10

#
Image Nevermind. I just tried to attack while standing still but it still doesn't work. The image that I put is how my screen looks like when I hold E while standing still.
You need to login to post a reply.