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

2018/6/7

Getting the error "java.lang.IllegalArgumentException: java.io.FileNotFoundException: Could not find file: (file)

Lev Lev

2018/6/7

#
Hi, I'm almost done this maze game for my final computers project, and I'm making and have encountered an error that I cannot fix at all. java.lang.IllegalArgumentException: java.io.FileNotFoundException: Could not find file: RogueUpA It's something to do with an image file called "RogueUpA", and I've tried everything I could to fix it, and It's due tomorrow. Please help... Here is the code for my Rogue:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
public class Rogue extends Animal
{
     
    private int rotateLeft, rotateRight, rotateUp, rotateDown;
     
    private GreenfootImage image1 = new GreenfootImage("RogueUpA");          
    private GreenfootImage image2 = new GreenfootImage("RogueLeftA");
    private GreenfootImage image3 = new GreenfootImage("RogueRightA");
    private GreenfootImage image4 = new GreenfootImage("RogueSmallA");
 
        
    public void act()
    {           
        movement();
        checkObstacle();
        fire();
        
        rotateRight = 0;
        rotateLeft = 180;
        rotateUp = 270;
        rotateDown = 90;
    }
 
    public void movement()
    {      
        Actor wall = getOneIntersectingObject(Wall.class);
        Bullet bullet1 = new Bullet();
 
                if(Greenfoot.isKeyDown("up"))
        {
                        setImage(image1);
            setRotation(270);
            move(1);
 
            if(canSee(Wall.class))
            {
                move(-1);
            }
        }
        if(Greenfoot.isKeyDown("down"))
        {
                       setImage(image2);
                        
            setRotation(90);
            move(1);
 
            if(canSee(Wall.class))
            {
                move(-1);
            }
        }
        if(Greenfoot.isKeyDown("left"))
        {
                       setImage(image3);
                        
            setRotation(180);
            move(1);
 
            if(canSee(Wall.class))
            {
                move(-1);
            }
        }
        if(Greenfoot.isKeyDown("right"))
        {
                       setImage(image4);
            setRotation(0);
            move(1);
 
            if(canSee(Wall.class))
            {
                move(-1);
            }
        }     
    }
 
    public void checkObstacle()
    {
       
                if(canSee(Leviathan.class))
        {
            Greenfoot.setWorld(new Loser());
        }
                if(canSee(Enemy.class))
        {
            Greenfoot.setWorld(new Loser());
        }
    }
 
    private void fire() {
        Bullet bullet1 = new Bullet();
 
        if ("space".equals(Greenfoot.getKey()))
        {
            getWorld().addObject(bullet1, getX(),getY());
            bullet1.setRotation(getRotation());
        }
    }
}
danpost danpost

2018/6/7

#
Lev wrote...
I'm making and have encountered an error that I cannot fix at all. java.lang.IllegalArgumentException: java.io.FileNotFoundException: Could not find file: RogueUpA
The file names are missing their extensions (".jpg", ".png", or ".gif").
You need to login to post a reply.