mirror of
				https://github.com/ynerant/Level-Editor.git
				synced 2025-11-03 23:52:05 +01:00 
			
		
		
		
	Ajouté collision d'items
This commit is contained in:
		@@ -9,6 +9,7 @@ public class Case
 | 
				
			|||||||
	private Sprite couche1;
 | 
						private Sprite couche1;
 | 
				
			||||||
	private Sprite couche2;
 | 
						private Sprite couche2;
 | 
				
			||||||
	private Sprite couche3;
 | 
						private Sprite couche3;
 | 
				
			||||||
 | 
						private Collision collision;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public int getPosX()
 | 
						public int getPosX()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -35,7 +36,12 @@ public class Case
 | 
				
			|||||||
		return couche3;
 | 
							return couche3;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public static Case create(int posX, int posY, Sprite couche1,  Sprite couche2, Sprite couche3)
 | 
						public Collision getCollision()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return collision;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public static Case create(int posX, int posY, Sprite couche1,  Sprite couche2, Sprite couche3, Collision collision)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		Case c = new Case();
 | 
							Case c = new Case();
 | 
				
			||||||
		c.x = posX;
 | 
							c.x = posX;
 | 
				
			||||||
@@ -43,6 +49,7 @@ public class Case
 | 
				
			|||||||
		c.couche1 = couche1;
 | 
							c.couche1 = couche1;
 | 
				
			||||||
		c.couche2 = couche2;
 | 
							c.couche2 = couche2;
 | 
				
			||||||
		c.couche3 = couche3;
 | 
							c.couche3 = couche3;
 | 
				
			||||||
 | 
							c.collision = collision;
 | 
				
			||||||
		return c;
 | 
							return c;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ public class EditorAPI
 | 
				
			|||||||
		{
 | 
							{
 | 
				
			||||||
			for (int x = 1; x < width; x += 16)
 | 
								for (int x = 1; x < width; x += 16)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				RawCase c = RawCase.create(x / 16, y / 16, RawSprite.BLANK, RawSprite.BLANK, RawSprite.BLANK);
 | 
									RawCase c = RawCase.create(x / 16, y / 16, RawSprite.BLANK, RawSprite.BLANK, RawSprite.BLANK, Collision.ANY);
 | 
				
			||||||
				cases.add(c);
 | 
									cases.add(c);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -7,6 +7,7 @@ public class RawCase
 | 
				
			|||||||
	private RawSprite couche1;
 | 
						private RawSprite couche1;
 | 
				
			||||||
	private RawSprite couche2;
 | 
						private RawSprite couche2;
 | 
				
			||||||
	private RawSprite couche3;
 | 
						private RawSprite couche3;
 | 
				
			||||||
 | 
						private Collision collision;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public int getPosX()
 | 
						public int getPosX()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
@@ -33,7 +34,12 @@ public class RawCase
 | 
				
			|||||||
		return couche3;
 | 
							return couche3;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public static RawCase create(int posX, int posY, RawSprite couche1,  RawSprite couche2, RawSprite couche3)
 | 
						public Collision getCollision()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							return collision;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public static RawCase create(int posX, int posY, RawSprite couche1,  RawSprite couche2, RawSprite couche3, Collision  collision)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		RawCase c = new RawCase();
 | 
							RawCase c = new RawCase();
 | 
				
			||||||
		c.x = posX;
 | 
							c.x = posX;
 | 
				
			||||||
@@ -41,6 +47,7 @@ public class RawCase
 | 
				
			|||||||
		c.couche1 = couche1;
 | 
							c.couche1 = couche1;
 | 
				
			||||||
		c.couche2 = couche2;
 | 
							c.couche2 = couche2;
 | 
				
			||||||
		c.couche3 = couche3;
 | 
							c.couche3 = couche3;
 | 
				
			||||||
 | 
							c.collision = collision;;
 | 
				
			||||||
		return c;
 | 
							return c;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@ public class Map
 | 
				
			|||||||
		
 | 
							
 | 
				
			||||||
		for (RawCase rc : raw.getCases())
 | 
							for (RawCase rc : raw.getCases())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			cases.add(Case.create(rc.getPosX(), rc.getPosY(), SpriteRegister.getCategory(rc.getCoucheOne().getPrimaryIndex()).getSprites().get(rc.getCoucheOne().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheTwo().getPrimaryIndex()).getSprites().get(rc.getCoucheTwo().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheThree().getPrimaryIndex()).getSprites().get(rc.getCoucheThree().getSecondaryIndex())));
 | 
								cases.add(Case.create(rc.getPosX(), rc.getPosY(), SpriteRegister.getCategory(rc.getCoucheOne().getPrimaryIndex()).getSprites().get(rc.getCoucheOne().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheTwo().getPrimaryIndex()).getSprites().get(rc.getCoucheTwo().getSecondaryIndex()), SpriteRegister.getCategory(rc.getCoucheThree().getPrimaryIndex()).getSprites().get(rc.getCoucheThree().getSecondaryIndex()), rc.getCollision()));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		frame = new EditorFrame(this);
 | 
							frame = new EditorFrame(this);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user