Skip to content

Commit

Permalink
bug fix: doors now open
Browse files Browse the repository at this point in the history
  • Loading branch information
DanAmador committed Jan 24, 2017
1 parent 020fdb5 commit 3a7647d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion content/entities2.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<entities anm2root="gfx/effects/" version="5">
<entity anm2path="gravgun.anm2" baseHP="0" boss="0" champion="0" collisionDamage="0" collisionMass="3" collisionRadius="8" friction="1" id="101234" name="Gravity Gun" numGridCollisionPoints="0" shadowSize="10" stageHP="0" variant="0">
<entity anm2path="gravgun.anm2" shutdoors="false" baseHP="0" boss="0" champion="0" collisionDamage="0" collisionMass="3" collisionRadius="8" friction="1" id="101234" name="Gravity Gun" numGridCollisionPoints="0" shadowSize="10" stageHP="0" variant="0">
<gibs amount="0" blood="0" bone="0" eye="0" gut="0" large="0" />
</entity>
</entities>
23 changes: 9 additions & 14 deletions main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ if player:HasCollectible(grav_gun_item) then
if room ~= prevRoom then ResetGun() end
if grav_gun == nil then grav_gun = Isaac.Spawn(grav_gun_entity,0,0,Vector(player.Position.X + (math.cos(angle) * 25), player.Position.Y + (math.sin(angle) * 25)- 10),Vector(0,0),nil) end
prevRoom = room
sprite = grav_gun:GetSprite()
sprite = grav_gun:GetSprite()
grav_gun.Position = Vector(player.Position.X + (math.cos(angle) * 25), player.Position.Y + (math.sin(angle) * 25) - 10);
grav_gun.SpriteRotation = math.deg(angle)
-- grav_gun.PositionOffset = Vector(25,-10)

if enemy_grabbed ~= nil then
if grabbed_flag then
sprite:Play("grav_gun_charge", true)

sprite:Play("grav_gun_charge", true)
trianglePoints = grav_gun_mod:getTrianglePoints(player.Position.X, player.Position.Y, angle, 90)
new_position_vector = trianglePoints
enemy_grabbed.Position = new_position_vector
Expand All @@ -49,18 +47,10 @@ if player:HasCollectible(grav_gun_item) then
enemy_grabbed = nil
end
end

end
else
sprite:Play("grav_gun_idle",true)
end

-- DEBUG SHIT
local entities = Isaac.GetRoomEntities()
local debug_offset = 20
Isaac.RenderText( "angle:" .. angle , 100, 10, 255,55,55,255 )
Isaac.RenderText(player.Position.X .. ", " .. player.Position.Y, 10, debug_offset, 255, 55, 55, 255)
grav_gun_mod:asciiDebug(createPolygon())
--grav_gun_mod:asciiDebug(createPolygon())
end

function ResetGun()
Expand Down Expand Up @@ -102,6 +92,12 @@ function grav_gun_mod:insidePolygon(point, polygon)
end

function grav_gun_mod:asciiDebug(polygon)
-- DEBUG SHIT
local player = Isaac.GetPlayer(0)
local entities = Isaac.GetRoomEntities()
local debug_offset = 20
Isaac.RenderText( "angle:" .. angle , 100, 10, 255,55,55,255 )
Isaac.RenderText(player.Position.X .. ", " .. player.Position.Y, 10, debug_offset, 255, 55, 55, 255)
for i=1, #polygon do
local screenVec = Isaac.WorldToRenderPosition(polygon[i])
Isaac.RenderText("X",screenVec.X, screenVec.Y, 255,55,55,255)
Expand Down Expand Up @@ -172,4 +168,3 @@ end

grav_gun_mod:AddCallback(ModCallbacks.MC_POST_RENDER, grav_gun_mod.render)
grav_gun_mod:AddCallback(ModCallbacks.MC_USE_ITEM, grav_gun_mod.item_use, grav_gun_item)
Isaac.DebugString("Mod was successfully loaded")

0 comments on commit 3a7647d

Please sign in to comment.