mirror of
https://github.com/guezoloic/racing-game.git
synced 2026-03-28 18:03:50 +00:00
feat: ajout une classe pour les inits de base
This commit is contained in:
20
src/GFactory.java
Normal file
20
src/GFactory.java
Normal file
@@ -0,0 +1,20 @@
|
||||
public class GFactory
|
||||
{
|
||||
public static Game defaultInit()
|
||||
{
|
||||
Integer[][] map = new Integer[][] {
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1, -1, 5, 0 },
|
||||
{ 0, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 0, 0, -1, 0, 0, -1, 0 },
|
||||
{ 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0 },
|
||||
{ 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, -1, 0, 0, -1, 0 },
|
||||
{ 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, -1, -1, 2, 0, 0, -1, 0 },
|
||||
{ 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0 },
|
||||
{ 0, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0 },
|
||||
{ 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -3, 0 },
|
||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
};
|
||||
return Game.getInstance().init(3, Map.fromInts(map));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,8 @@ public class Main {
|
||||
});
|
||||
|
||||
Thread t = new Thread(() -> {
|
||||
while (true)
|
||||
int i = 0;
|
||||
while (i++ < 10)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -17,13 +18,12 @@ public class Main {
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println(Game.create().togglePause() ? "stop" : "fini");
|
||||
System.out.println(Game.getInstance().togglePause() ? "stop" : "fini" );
|
||||
}
|
||||
});
|
||||
|
||||
t.start();
|
||||
Game.create()
|
||||
.init(3, m)
|
||||
Game.getInstance()
|
||||
.run();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user