I dont fucking know how to solve this shit i hate git #3
			
				
			
		
		
		
	| 
						 | 
					@ -2,7 +2,7 @@ Arrow = Entity:New(x,y)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 function Arrow:New(x,y,rotation,speed)
 | 
					 function Arrow:New(x,y,rotation,speed)
 | 
				
			||||||
 	local o = Entity:New(x,y)
 | 
					 	local o = Entity:New(x,y)
 | 
				
			||||||
 | 
					  arrow = arrow + 1
 | 
				
			||||||
 	o.pos = {x = x, y = y}
 | 
					 	o.pos = {x = x, y = y}
 | 
				
			||||||
  o.speed = speed or 0
 | 
					  o.speed = speed or 0
 | 
				
			||||||
  o.sprite_rotation = rotation or 0
 | 
					  o.sprite_rotation = rotation or 0
 | 
				
			||||||
| 
						 | 
					@ -32,45 +32,47 @@ function Arrow:HandleAnimation()
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function Arrow:DoPhysics()
 | 
					function Arrow:DoPhysics()
 | 
				
			||||||
   -- horizontal collisions
 | 
					  if not self.stuck then
 | 
				
			||||||
  if not isThereAnyCollisionAt(
 | 
					     -- horizontal collisions
 | 
				
			||||||
    self.pos.x + self.vel.x,
 | 
					    if not isThereAnyCollisionAt(
 | 
				
			||||||
    self.pos.y
 | 
					      self.pos.x + self.vel.x,
 | 
				
			||||||
  ) then
 | 
					      self.pos.y
 | 
				
			||||||
  	self.pos.x = self.pos.x + self.vel.x
 | 
					    ) then
 | 
				
			||||||
  else
 | 
					    	self.pos.x = self.pos.x + self.vel.x
 | 
				
			||||||
    while not isThereObjectAt(
 | 
					    else
 | 
				
			||||||
      self.pos.x + math.sign(self.vel.x),
 | 
					      while not isThereObjectAt(
 | 
				
			||||||
      self.pos.y,
 | 
					        self.pos.x + math.sign(self.vel.x),
 | 
				
			||||||
      objects.collisions
 | 
					        self.pos.y,
 | 
				
			||||||
    ) do
 | 
					        objects.collisions
 | 
				
			||||||
      self.pos.x = self.pos.x + math.sign(self.vel.x)
 | 
					      ) do
 | 
				
			||||||
 | 
					        self.pos.x = self.pos.x + math.sign(self.vel.x)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					      self.stuck = true
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    self.stuck = true
 | 
					      -- vertical collision
 | 
				
			||||||
  end
 | 
					    if not isThereAnyCollisionAt(
 | 
				
			||||||
    -- vertical collision
 | 
					 | 
				
			||||||
  if not isThereAnyCollisionAt(
 | 
					 | 
				
			||||||
    self.pos.x,
 | 
					 | 
				
			||||||
    self.pos.y + self.vel.y
 | 
					 | 
				
			||||||
  ) then
 | 
					 | 
				
			||||||
    self.pos.y = self.pos.y + self.vel.y
 | 
					 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    while not isThereObjectAt(
 | 
					 | 
				
			||||||
      self.pos.x,
 | 
					      self.pos.x,
 | 
				
			||||||
      self.pos.y + math.sign(self.vel.y),
 | 
					      self.pos.y + self.vel.y
 | 
				
			||||||
      objects.collisions
 | 
					    ) then
 | 
				
			||||||
    ) do
 | 
					      self.pos.y = self.pos.y + self.vel.y
 | 
				
			||||||
      self.pos.y = self.pos.y + math.sign(self.vel.y)
 | 
					    else
 | 
				
			||||||
 | 
					      while not isThereObjectAt(
 | 
				
			||||||
 | 
					        self.pos.x,
 | 
				
			||||||
 | 
					        self.pos.y + math.sign(self.vel.y),
 | 
				
			||||||
 | 
					        objects.collisions
 | 
				
			||||||
 | 
					      ) do
 | 
				
			||||||
 | 
					        self.pos.y = self.pos.y + math.sign(self.vel.y)
 | 
				
			||||||
 | 
					      end
 | 
				
			||||||
 | 
					      self.stuck = true
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    -- stuck into collisions
 | 
				
			||||||
 | 
					    if self.stuck then
 | 
				
			||||||
 | 
					      --lets allow the arrow to tip a bit into the thing
 | 
				
			||||||
 | 
					      self.pos.x = self.pos.x + self.vel.x / 5
 | 
				
			||||||
 | 
					      self.pos.y = self.pos.y + self.vel.y / 5
 | 
				
			||||||
 | 
					      self.vel.x = 0
 | 
				
			||||||
 | 
					      self.vel.y = 0
 | 
				
			||||||
 | 
					      self.illuminated = false
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
    self.stuck = true
 | 
					 | 
				
			||||||
  end
 | 
					 | 
				
			||||||
  -- stuck into collisions
 | 
					 | 
				
			||||||
  if self.stuck then
 | 
					 | 
				
			||||||
    --lets allow the arrow to tip a bit into the thing
 | 
					 | 
				
			||||||
    self.pos.x = self.pos.x + self.vel.x / 5
 | 
					 | 
				
			||||||
    self.pos.y = self.pos.y + self.vel.y / 5
 | 
					 | 
				
			||||||
    self.vel.x = 0
 | 
					 | 
				
			||||||
    self.vel.y = 0
 | 
					 | 
				
			||||||
    self.illuminated = false
 | 
					 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,8 +50,8 @@ end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function Fairy:DoPhysics()
 | 
					function Fairy:DoPhysics()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  local random_x = math.random(-0.04,0.04)
 | 
					  local random_x = math.random(-4, 4)/100
 | 
				
			||||||
  local random_y = math.random(-0.04,0.04)
 | 
					  local random_y = math.random(-4, 4)/100
 | 
				
			||||||
  self.vel.x = self.vel.x + random_x
 | 
					  self.vel.x = self.vel.x + random_x
 | 
				
			||||||
  self.vel.y = self.vel.y + random_y
 | 
					  self.vel.y = self.vel.y + random_y
 | 
				
			||||||
  -- move
 | 
					  -- move
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -69,9 +69,9 @@ function Kupo:Smart()
 | 
				
			||||||
          self.bow_rotation = angle
 | 
					          self.bow_rotation = angle
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      -- holding tight dispersion -- also affets arrows
 | 
					      -- holding tight dispersion -- also affects arrows
 | 
				
			||||||
      if self.bow_rotation == angle then
 | 
					      if self.bow_rotation == angle then
 | 
				
			||||||
        self.bow_rotation = self.bow_rotation + math.rad(math.random(math.abs(self.bow_frame-self.bow_aim_frames-self.bow_frames)/2))
 | 
					        self.bow_rotation = self.bow_rotation + math.rad(math.random(math.abs(math.floor(self.bow_frame-self.bow_aim_frames-self.bow_frames)/2)))
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      -- AIMING AI
 | 
					      -- AIMING AI
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,12 @@
 | 
				
			||||||
function stepEditor()
 | 
					function stepEditor()
 | 
				
			||||||
 | 
					  palette = palette or false
 | 
				
			||||||
  AnimateTiles()
 | 
					  AnimateTiles()
 | 
				
			||||||
 | 
					  if love.keyboard.isDown("tab") and not pressed then
 | 
				
			||||||
 | 
					    if palette then palette = false else palette = true end
 | 
				
			||||||
 | 
					    local pressed = true
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    pressed = false
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function stepGame()
 | 
					function stepGame()
 | 
				
			||||||
| 
						 | 
					@ -28,6 +35,9 @@ function drawEditor()
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  gameworldDraw()
 | 
					  gameworldDraw()
 | 
				
			||||||
 | 
					  if palette then
 | 
				
			||||||
 | 
					    paletteDraw()
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function drawGame()
 | 
					function drawGame()
 | 
				
			||||||
| 
						 | 
					@ -91,3 +101,66 @@ function gameworldLighting()
 | 
				
			||||||
	love.graphics.scale(1,1)
 | 
						love.graphics.scale(1,1)
 | 
				
			||||||
	DrawDarkness()
 | 
						DrawDarkness()
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function paletteDraw()
 | 
				
			||||||
 | 
						local width = LevelData.tileset:getPixelWidth()/tileProperties.width
 | 
				
			||||||
 | 
						local height = LevelData.tileset:getPixelHeight()/tileProperties.height
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						local position_x = 1
 | 
				
			||||||
 | 
						local position_y = 1
 | 
				
			||||||
 | 
						for i = 1, #TileIndex-width-1 do
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							love.graphics.draw(
 | 
				
			||||||
 | 
								LevelData.tileset,
 | 
				
			||||||
 | 
								TileIndex[i],
 | 
				
			||||||
 | 
								position_x * tileProperties.width*2,
 | 
				
			||||||
 | 
								(--[[p_scroll +]]position_y) * tileProperties.height*2,
 | 
				
			||||||
 | 
								0,
 | 
				
			||||||
 | 
								2,
 | 
				
			||||||
 | 
								2
 | 
				
			||||||
 | 
							)
 | 
				
			||||||
 | 
							position_x = position_x + 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if position_x > width then
 | 
				
			||||||
 | 
								position_x = position_x - width
 | 
				
			||||||
 | 
								position_y = position_y + 1
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						love.graphics.rectangle(
 | 
				
			||||||
 | 
							"line",
 | 
				
			||||||
 | 
								tileProperties.width*2,
 | 
				
			||||||
 | 
								(--[[p_scroll +]] 1) * tileProperties.height*2,
 | 
				
			||||||
 | 
								2*LevelData.tileset:getPixelWidth(),
 | 
				
			||||||
 | 
								2*LevelData.tileset:getPixelHeight()
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					--[[
 | 
				
			||||||
 | 
					function DrawSelectingPaletteTile()
 | 
				
			||||||
 | 
						if selecting_tile ~= nil then
 | 
				
			||||||
 | 
							local width = TileProperties.tileset:getPixelWidth()/TileProperties.width
 | 
				
			||||||
 | 
							local height = TileProperties.tileset:getPixelHeight()/TileProperties.height
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							local positionx = 1
 | 
				
			||||||
 | 
							local positiony = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							for i = 1, #Tile-12 do
 | 
				
			||||||
 | 
								if i == selecting_tile then
 | 
				
			||||||
 | 
									love.graphics.rectangle(
 | 
				
			||||||
 | 
										"line",
 | 
				
			||||||
 | 
										positionx * TileProperties.width*2,
 | 
				
			||||||
 | 
										(p_scroll + positiony) * TileProperties.height*2,
 | 
				
			||||||
 | 
										TileProperties.width*2-1,
 | 
				
			||||||
 | 
										TileProperties.height*2-1
 | 
				
			||||||
 | 
									)
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								positionx = positionx + 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if positionx > width then
 | 
				
			||||||
 | 
									positionx = positionx - width
 | 
				
			||||||
 | 
									positiony = positiony + 1
 | 
				
			||||||
 | 
								end
 | 
				
			||||||
 | 
							end
 | 
				
			||||||
 | 
						end
 | 
				
			||||||
 | 
					end]]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -19,6 +19,7 @@ function CreateLight(x,y,range,lum,flicker)
 | 
				
			||||||
	o.flicker_speed = flicker_speed or 60/12
 | 
						o.flicker_speed = flicker_speed or 60/12
 | 
				
			||||||
	o.flicker_time = 0
 | 
						o.flicker_time = 0
 | 
				
			||||||
	table.insert(Lights,o)
 | 
						table.insert(Lights,o)
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	return o
 | 
						return o
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue