Turrets -- v1.4 RELEASED [Both Directions!]

Mods, guides how to use and install mods go right in here.
User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 05 Apr 2012, 23:25

I decided to give it a try. So far, I can only place it. It's quite buggy. I added a few sounds. I just need to make it hurt Mario. Also see him like a bullet bill..

SNAPSHOTS

Image

Turrets: Side by Side
Left: Editor
Right: In-game

Progress:
4/05/12
http://www.youtube.com/watch?v=FJG1dtnJ2qM
4/7/12


RELEASES:

v1.4
http://www.mediafire.com/?tjmkby9ghdd6335

NOTES:
Grabbing the turret isn't very effective. Do not attempt. Unless you want an error screen. I will fix this shortly.
For right now, it's only turrets facing the right. Enjoy you guys :D

Any bugs other than grabbing the turret are now fixed. You can't get harmed by the laser if you jump on it, but I will fix that tomorrow.

Thanks for being extremely patient!

Questions:

Do I have to place "Turret Laser"
No. I just put it there. Thought I should if it was needed in order to run the firing script.
Last edited by Turtle95 on 11 Apr 2012, 05:11, edited 11 times in total.

User avatar
Pyrosaur
Posts: 769
Joined: 03 Feb 2012, 00:15
Contact:

Post » 05 Apr 2012, 23:29

You need a turret sprite? Because that one looks a bit out of place.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 05 Apr 2012, 23:30

Pyr0saur wrote:You need a turret sprite? Because that one looks a bit out of place.
Nah. I think it's fine. It's not too bad.

User avatar
fakeuser
Posts: 135
Joined: 04 Mar 2012, 01:20

Post » 06 Apr 2012, 00:55

I suggest you make it's width one tile. This one is way too stable (it's COM lies in its bottom), how are you supposed to knock it down? In Portal they are made tall and narrow

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 00:58

fakeuser wrote:I suggest you make it's width one tile. This one is way too stable (it's COM lies in its bottom), how are you supposed to knock it down? In Portal they are made tall and narrow
I'll find a way. Or--Let's have a turret design contest then? (hits desk) let's do this!

Seriously, we shall have a turret design contest. Also if anyone would like to help, I am more than glad to allow extra help.

User avatar
Pyrosaur
Posts: 769
Joined: 03 Feb 2012, 00:15
Contact:

Post » 06 Apr 2012, 01:25

Image
Here ya go.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 01:29

Pyr0saur wrote:Image
Here ya go.
..You're kidding right? That's quite small.. and not detailed much.

Camewel
Posts: 2996
Joined: 02 Feb 2012, 21:32

Post » 06 Apr 2012, 01:33

I like it much more than I like the one in the original post.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 01:43

I edited the original turret. Maybe now it looks better.

Image

Maurice
Stabyourself.net
Posts: 2145
Joined: 01 Feb 2012, 20:19

Post » 06 Apr 2012, 01:52

Pyrosaur has the right idea.

User avatar
Pyrosaur
Posts: 769
Joined: 03 Feb 2012, 00:15
Contact:

Post » 06 Apr 2012, 01:53

Turtle95 wrote:
Pyr0saur wrote:Image
Here ya go.
..You're kidding right? That's quite small.. and not detailed much.
No shit. That's the point. It's supposed to look like it would fit in the game. Which one looks more like the goomba: Mine, or the one in the picture? As for the size, I don't know what you're talking about. 8-bit sprites are tiny. Here's a size comparison: Image

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 01:55

Maurice wrote:Pyrosaur has the right idea.
Yes, but in-game, the sprites are much bigger.

Maurice
Stabyourself.net
Posts: 2145
Joined: 01 Feb 2012, 20:19

Post » 06 Apr 2012, 01:56

Turtle95 wrote:
Maurice wrote:Pyrosaur has the right idea.
Yes, but in-game, the sprites are much bigger.
Compare to size of other portal props. The cube is 12x12 iirc.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 01:59

Maurice wrote:
Turtle95 wrote:
Maurice wrote:Pyrosaur has the right idea.
Yes, but in-game, the sprites are much bigger.
Compare to size of other portal props. The cube is 12x12 iirc.
I'll resize his turret. See where that goes.

EDIT:

Doesn't look too bad. It could use a bit more detail TBH. It fell through the floor.. wtf.

User avatar
Pyrosaur
Posts: 769
Joined: 03 Feb 2012, 00:15
Contact:

Post » 06 Apr 2012, 02:28

Saying the turret needs more detail is like saying the goomba needs more detail.

Camewel
Posts: 2996
Joined: 02 Feb 2012, 21:32

Post » 06 Apr 2012, 02:34

Dude that goomba would have aged.
Someone give it wrinkles.

Pyrosaur's turret is pretty much perfectly suited to Mari0's environment, it's the right size and simplistic in graphical style.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 02:46

Camewel wrote:Dude that goomba would have aged.
Someone give it wrinkles.

Pyrosaur's turret is pretty much perfectly suited to Mari0's environment, it's the right size and simplistic in graphical style.
Alright, I suppose it is. It is indeed. I just wasn't sure at first. Anyway, I'm slightly resizing it in the code. Make it a bit menacing..
Last edited by Turtle95 on 06 Apr 2012, 02:50, edited 1 time in total.

User avatar
idiot9.0
Posts: 1707
Joined: 09 Mar 2012, 10:28
Contact:

Post » 06 Apr 2012, 02:46

Sorry for interrupting, but I decided to try making a turret myself:

Image

It's 16x32, so it's the size of big Mario. Dunno what size you guys were going for, but meh, thought it was a good size myself. Anyway, there it is.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 02:50

idiot9.0 wrote:Sorry for interrupting, but I decided to try making a turret myself:

Image

It's 16x32, so it's the size of big Mario. Dunno what size you guys were going for, but meh, thought it was a good size myself. Anyway, there it is.
Hm.. That's better really. I do like em both. But--this proves more situated because Mario will be "threatened" by its height. Plus a bit more detail. (Where the guns pull out is shown, nice work dude!) The one problem I am having regardless, is the damn thing goes under the floor if you drop it under the floor. If you're reading this Maurice, please help me fix this.

Camewel
Posts: 2996
Joined: 02 Feb 2012, 21:32

Post » 06 Apr 2012, 02:55

Turtle95 wrote:But--this proves more situated because Mario will be "threatened" by its height.
Oh shit guys this image stretches out over a whole 32 pixels everyone just run.
Turtle95 wrote:The one problem I am having regardless, is the damn thing goes under the floor if you drop it under the floor. If you're reading this Maurice, please help me fix this.
There's a function to do with cubes being dropped that you may want to steal (cubedropped(), if I'm not mistaken), it stops you dropping the cube inside anything solid.

User avatar
Elbow
Posts: 45
Joined: 05 Feb 2012, 01:51

Post » 06 Apr 2012, 02:59

I made a really good SMB styled turret a while back. I suggest you use it, because honestly, the ones posted here don't look SMB styled, and they were drawn bad.

Image
Last edited by Elbow on 06 Apr 2012, 02:59, edited 1 time in total.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 02:59

Camewel wrote:
Turtle95 wrote:But--this proves more situated because Mario will be "threatened" by its height.
Oh shit guys this image stretches out over a whole 32 pixels everyone just run.
Turtle95 wrote:The one problem I am having regardless, is the damn thing goes under the floor if you drop it under the floor. If you're reading this Maurice, please help me fix this.
There's a function to do with cubes being dropped that you may want to steal (cubedropped(), if I'm not mistaken), it stops you dropping the cube inside anything solid.
Hm.. *goes to look at code*

Ah in cubedropper.lua.

How do I freaking call that? o_0

Camewel
Posts: 2996
Joined: 02 Feb 2012, 21:32

Post » 06 Apr 2012, 03:01

No, box.lua.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 03:05

Camewel wrote:No, box.lua.
It IS the box.lua. It's only temporary. Dunno why it's not being used properly.

Called it in floorcollide()

Nothing.

This is all the code (so far)

Code: Select all

box = class:new()

function box:init(x, y)
	--PHYSICS STUFF
	self.cox = x
	self.coy = y
	self.x = x-12/16
	self.y = y-14/16
	self.speedy = 0
	self.speedx = 0
	self.width = 12/16
	self.height = 14/16
	self.static = false
	self.active = true
	self.category = 9
	self.parent = nil
	self.portaloverride = true

	self.mask = {	true,
					false, false, false, false, false,
					false, true, false, true, true,
					false, false, true, false, false,
					true, true, false, false, true,
					false, true, true, false, false,
					true, false, true, true, true}
					
	self.emancipatecheck = true

	self.userect = adduserect(self.x, self.y, 12/16, 14/16, self)
	
	--IMAGE STUFF
	self.drawable = true
	self.graphic = Turret
	self.quad = Turretquad
	self.offsetX = 6
	self.offsetY = 6
	self.quadcenterX = 6
	self.quadcenterY = 6
	
	self.rotation = 0 --for portals
	
	self.falling = false
	self.destroying = false
	self.outtable = {}
	self.portaledframe = false
end



function box:update(dt)

	local friction = boxfrictionair
	if self.falling == false then
		friction = boxfriction
	end
	
	if not self.pushed then
		if self.speedx > 0 then
			self.speedx = self.speedx - friction*dt
			if self.speedx < 0 then
				self.speedx = 0
			end
		else
			self.speedx = self.speedx + friction*dt
			if self.speedx > 0 then
				self.speedx = 0
			end
		end
	else
		self.pushed = false
	end
	
	--rotate back to 0 (portals)
	self.rotation = math.mod(self.rotation, math.pi*2)
	if self.rotation > 0 then
		self.rotation = self.rotation - portalrotationalignmentspeed*dt
		if self.rotation < 0 then
			self.rotation = 0
		end
	elseif self.rotation < 0 then
		self.rotation = self.rotation + portalrotationalignmentspeed*dt
		if self.rotation > 0 then
			self.rotation = 0
		end
	end
	
	if self.parent then
		local oldx = self.x
		local oldy = self.y
		
		self.x = self.parent.x+math.sin(-self.parent.pointingangle)*0.3
		self.y = self.parent.y-math.cos(-self.parent.pointingangle)*0.3
		
		if self.portaledframe == false then
			for h, u in pairs(emancipationgrills) do
				if u.dir == "hor" then
					if inrange(self.x+6/16, u.startx-1, u.endx, true) and inrange(u.y-14/16, oldy, self.y, true) then
						self:emancipate(h)
					end
				else
					if inrange(self.y+6/16, u.starty-1, u.endy, true) and inrange(u.x-14/16, oldx, self.x, true) then
						self:emancipate(h)
					end
				end
			end
		end
	end
	
	self.userect.x = self.x
	self.userect.y = self.y

	--check if offscreen
	if self.y > 17 then
		self:destroy()
	end
	
	self.portaledframe = false
	
	if self.destroying then
		return true
	else
		return false
	end
end

function box:leftcollide(a, b)
	if a == "button" then
		self.y = b.y - self.height
		self.x = b.x + b.width - 0.01
		if self.speedy > 0 then
			self.speedy = 0
		end
		return false
	elseif a == "player" then
		self.pushed = true
		return false
	end
end

function box:rightcollide(a, b)
	if a == "button" then
		self.y = b.y - self.height
		self.x = b.x - self.width+0.01
		if self.speedy > 0 then
			self.speedy = 0
		end
		return false
	elseif a == "player" then
		self.pushed = true
		return false
	end
end

function box:floorcollide(a, b)
	if self.falling then
		self.falling = false
	end
	
	if a == "goomba" or a == "bulletbill" then
		b:stomp()
		addpoints(200, self.x, self.y)
		playsound(stompsound)
		self.falling = true
		return false
	end
	
	box:dropped()
end

function box:passivecollide(a, b)
	if a == "player" then
		if self.x+self.width > b.x+b.width then
			self.x = b.x+b.width
		else
			self.x = b.x-self.width
		end
	end
end

function box:startfall()
	self.falling = true
end

function box:emancipate()
	if self.parent then
		self.parent:cubeemancipate()
	end
	self:destroy()
	playsound(emancipater)
	playsound(emancipated)
end


function box:destroy()
	self.userect.delete = true
	self.destroying = true

	for i = 1, #self.outtable do
		if self.outtable[i].input then
			self.outtable[i]:input("toggle")
		end
	end
end

function box:addoutput(a)
	table.insert(self.outtable, a)
end

function box:used(id)
	self.parent = objects["player"][id]
	self.active = false
	objects["player"][id]:pickupbox(self)
	speech = math.random(0, 4)
	if speech == 0 then
	playsound(who)
	end
	if speech == 1 then
	playsound(please)
	end
end

function box:dropped()
	self.parent = nil
	self.active = true
end

function box:portaled()
	self.portaledframe = true
end
	

Camewel
Posts: 2996
Joined: 02 Feb 2012, 21:32

Post » 06 Apr 2012, 03:08

Wait for Maurice to wake up, he knows this code better than anyone else.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 03:12

Camewel wrote:Wait for Maurice to wake up, he knows this code better than anyone else.
I agree. I saw your post where you were acting like Maurice and in a nutshell, he said, "approved" lol. But anywho, yea. Wake up Maurice.

User avatar
Pyrosaur
Posts: 769
Joined: 03 Feb 2012, 00:15
Contact:

Post » 06 Apr 2012, 03:22

Elbow wrote:I made a really good SMB styled turret a while back. I suggest you use it, because honestly, the ones posted here don't look SMB styled, and they were drawn bad.

Image
Well aren't you special.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 03:24

Pyr0saur wrote:
Elbow wrote:I made a really good SMB styled turret a while back. I suggest you use it, because honestly, the ones posted here don't look SMB styled, and they were drawn bad.

Image
Well aren't you special.
You don't have to be a complete jerk. It's nice, but too big and NES-y. Not great to look at while playing Mari0 though..

User avatar
Pyrosaur
Posts: 769
Joined: 03 Feb 2012, 00:15
Contact:

Post » 06 Apr 2012, 03:29

Turtle95 wrote:
Pyr0saur wrote:
Elbow wrote:I made a really good SMB styled turret a while back. I suggest you use it, because honestly, the ones posted here don't look SMB styled, and they were drawn bad.

Image
Well aren't you special.
You don't have to be a complete jerk. It's nice, but too big and NES-y. Not great to look at while playing Mari0 though..
I don't? I think I need to go rethink my entire life.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 03:46

Progress of the mod is in a video in the first post. Enjoy what I have so far.

User avatar
12seth12
Posts: 139
Joined: 11 Mar 2012, 20:42

Post » 06 Apr 2012, 09:07

I really like the video of the mod, it's coming up quite nicely if i do say so myself
┌─┐
┴─┴
ಠ_ರೃ

User avatar
PloXyZeRO
Posts: 321
Joined: 03 Apr 2012, 21:43
Contact:

Post » 06 Apr 2012, 10:07

I think that Pyr0saur has a perfect sprite. It looks looks better inside the rest of the world. Now compared to the other turrets, not so much, but that's obviously because they have more room for detail. But they look out of place inside an 8-bit game...mostly because they're NOT 8-bit.

But it's up to you since you're the one making the mod after all.

Maurice
Stabyourself.net
Posts: 2145
Joined: 01 Feb 2012, 20:19

Post » 06 Apr 2012, 11:32

mario:dropbox()

I am going to guess you changed the turret's height, so you'll need to replace 12/16 with whatever you got, and differenciate between box and turret.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 14:35

Maurice wrote:mario:dropbox()

I am going to guess you changed the turret's height, so you'll need to replace 12/16 with whatever you got, and differenciate between box and turret.
Ok. So mario:dropbox should be called in which,, Time to play around with that. I just woke up lol.

EDIT: Edited the height you grab the "box". Changed it to 14. Now it's fine :D

Now. Time to fire dem lazors (yes, mis-spelled on purpose. Know your memes.)

User avatar
fakeuser
Posts: 135
Joined: 04 Mar 2012, 01:20

Post » 06 Apr 2012, 17:57

Turtle95 wrote:Progress of the mod is in a video in the first post. Enjoy what I have so far.
I like the sounds, especially the emancipating turret! However some suggestions
  • You have copied some mario.lua code to make turret physics? I am asking because the turret landed on its feet (like mario). That's exactly what you don't want a turret to do, when you portal it somewhere
  • "Shutting down" sound and system error. Meaning tilted turret shut be offline
  • That laser should really kill the turret. One of the best things of portal was burning the one-eyed monsters
  • Turrets laser sight would be a cool feature
Nice work, hope you finish this.
P.s. turret dropper?! WTF man?!

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 06 Apr 2012, 18:35

fakeuser wrote:
Turtle95 wrote:Progress of the mod is in a video in the first post. Enjoy what I have so far.
I like the sounds, especially the emancipating turret! However some suggestions
  • You have copied some mario.lua code to make turret physics? I am asking because the turret landed on its feet (like mario). That's exactly what you don't want a turret to do, when you portal it somewhere
  • "Shutting down" sound and system error. Meaning tilted turret shut be offline
  • That laser should really kill the turret. One of the best things of portal was burning the one-eyed monsters
  • Turrets laser sight would be a cool feature
Nice work, hope you finish this.
P.s. turret dropper?! WTF man?!
Thanks. I plan to do all that. It's not Mario its the box entity. That's why it comes out the cube dispenser lol. The sight is just a matter to address once it can shoot Mario. So far it is not drawing the laser and the people over at the LOVE forums have not gotten back on that. :/ but I'll try to put those in when I can. I'm not exactly on my pc right now.

Camewel
Posts: 2996
Joined: 02 Feb 2012, 21:32

Post » 06 Apr 2012, 18:43

Just delete lines 70-82 of box.lua and it will no longer right itself.

User avatar
rokit
Posts: 2095
Joined: 03 Feb 2012, 00:47

Post » 06 Apr 2012, 19:26

Can you show us how they shoot?

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 07 Apr 2012, 04:56

Camewel wrote:Just delete lines 70-82 of box.lua and it will no longer right itself.

Sorry just got back on my laptop. And how would that help? I'm just trying to fire a lazor (yes, meme intended). Lemme check the LOVE forums while I wait for your reply.

EDIT:

THIS is the code so far.

Code: Select all

box = class:new()

function box:init(x, y)
	--PHYSICS STUFF
	self.cox = x
	self.coy = y
	self.x = x-12/16
	self.y = y-14/16
	self.speedy = 0
	self.speedx = 0
	self.width = 12/16
	self.height = 14/16
	self.static = false
	self.active = true
	self.category = 9
	self.parent = nil
	self.portaloverride = true

	self.mask = {	true,
					false, false, false, false, false,
					false, true, false, true, true,
					false, false, true, false, false,
					true, true, false, false, true,
					false, true, true, false, false,
					true, false, true, true, true}
					
	self.emancipatecheck = true

	self.userect = adduserect(self.x, self.y, 12/16, 12/16, self)
	
	--IMAGE STUFF
	self.drawable = true
	self.graphic = Turret
	self.quad = Turretquad
	self.offsetX = 6
	self.offsetY = 6
	self.quadcenterX = 6
	self.quadcenterY = 6
	
	self.rotation = 0 --for portals
	
	self.falling = false
	self.destroying = false
	self.outtable = {}
	self.portaledframe = false
end

function box:draw()
	love.graphics.draw(lazerimg, self.x, self.y)
end


function box:update(dt)

	local friction = boxfrictionair
	if self.falling == false then
		friction = boxfriction
	end
	
	if not self.pushed then
		if self.speedx > 0 then
			self.speedx = self.speedx - friction*dt
			if self.speedx < 0 then
				self.speedx = 0
			end
		else
			self.speedx = self.speedx + friction*dt
			if self.speedx > 0 then
				self.speedx = 0
			end
		end
	else
		self.pushed = false
	end
	
	--rotate back to 0 (portals)
	self.rotation = math.mod(self.rotation, math.pi*2)
	if self.rotation > 0 then
		self.rotation = self.rotation - portalrotationalignmentspeed*dt
		if self.rotation < 0 then
			self.rotation = 0
		end
	elseif self.rotation < 0 then
		self.rotation = self.rotation + portalrotationalignmentspeed*dt
		if self.rotation > 0 then
			self.rotation = 0
		end
	end
	
	if self.parent then
		local oldx = self.x
		local oldy = self.y
		
		self.x = self.parent.x+math.sin(-self.parent.pointingangle)*0.3
		self.y = self.parent.y-math.cos(-self.parent.pointingangle)*0.3
		
		if self.portaledframe == false then
			for h, u in pairs(emancipationgrills) do
				if u.dir == "hor" then
					if inrange(self.x+6/16, u.startx-1, u.endx, true) and inrange(u.y-14/16, oldy, self.y, true) then
						self:emancipate(h)
					end
				else
					if inrange(self.y+6/16, u.starty-1, u.endy, true) and inrange(u.x-14/16, oldx, self.x, true) then
						self:emancipate(h)
					end
				end
			end
		end
	end
	
	self.userect.x = self.x
	self.userect.y = self.y

	--check if offscreen
	if self.y > 17 then
		self:destroy()
	end
	
	self.portaledframe = false
	
	if self.destroying then
		return true
	else
		return false
	end
end

function box:leftcollide(a, b)
	if a == "button" then
		self.y = b.y - self.height
		self.x = b.x + b.width - 0.01
		if self.speedy > 0 then
			self.speedy = 0
		end
		return false
	elseif a == "player" then
		self.pushed = true
		return false
	end
end

function box:rightcollide(a, b)
	if a == "button" then
		self.y = b.y - self.height
		self.x = b.x - self.width+0.01
		if self.speedy > 0 then
			self.speedy = 0
		end
		return false
	elseif a == "player" then
		self.pushed = true
		return false
	end
end

function box:floorcollide(a, b)
	if self.falling then
		self.falling = false
	end
	
	if a == "goomba" or a == "bulletbill" then
		b:stomp()
		addpoints(200, self.x, self.y)
		playsound(stompsound)
		self.falling = true
		return false
	end
	
end

function box:passivecollide(a, b)
	if a == "player" then
		if self.x+self.width > b.x+b.width then
			self.x = b.x+b.width
		else
			self.x = b.x-self.width
		end
	end
end

function box:startfall()
	self.falling = true
	speech = math.random(0, 1)
	if speech == 0 then
		playsound(wee)
	end 
end

function box:emancipate()
	if self.parent then
		self.parent:cubeemancipate()
	end
	self:destroy()
	playsound(emancipater)
	playsound(emancipated)
end


function box:destroy()
	self.userect.delete = true
	self.destroying = true

	for i = 1, #self.outtable do
		if self.outtable[i].input then
			self.outtable[i]:input("toggle")
		end
	end
end

function box:addoutput(a)
	table.insert(self.outtable, a)
end


function box:used(id)
	self.parent = objects["player"][id]
	self.active = false
	objects["player"][id]:pickupbox(self)
	if self.falling == false then
	speech = math.random(0, 4)
	if speech == 0 then
	playsound(who)
	end
	if speech == 1 then
	playsound(please)
	end
end
	
end

function box:dropped()
	self.parent = nil
	self.active = true
end

function box:portaled()
	self.portaledframe = true
end
I'm gonna add rotation. Muahaha. Then shutting down. Or if I get lazers working, surprised fire THEN shut down..

Camewel
Posts: 2996
Joined: 02 Feb 2012, 21:32

Post » 07 Apr 2012, 05:03

Take out the bit that says '--rotate back to 0 (portals)' or the turret will eternally right itself and be unkillable.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 07 Apr 2012, 05:50

Camewel wrote:Take out the bit that says '--rotate back to 0 (portals)' or the turret will eternally right itself and be unkillable.

It crashes if i take that out. BTW that's a comment, it has no effect.


EDIT:

Nvm. Its fine. Gotta make the turret work like in Portal/2 now. Gravity leans it.. idk if you guys would care.

User avatar
fakeuser
Posts: 135
Joined: 04 Mar 2012, 01:20

Post » 07 Apr 2012, 11:08

Turtle95 wrote:
Camewel wrote:Take out the bit that says '--rotate back to 0 (portals)' or the turret will eternally right itself and be unkillable.

It crashes if i take that out. BTW that's a comment, it has no effect.
I hope you have figured out yourself he didn't mean the comment, but the code below it

Code: Select all

   --rotate back to 0 (portals)
   self.rotation = math.mod(self.rotation, math.pi*2)
   if self.rotation > 0 then
      self.rotation = self.rotation - portalrotationalignmentspeed*dt
      if self.rotation < 0 then
         self.rotation = 0
      end
   elseif self.rotation < 0 then
      self.rotation = self.rotation + portalrotationalignmentspeed*dt
      if self.rotation > 0 then
         self.rotation = 0
      end
   end

User avatar
ERich935
Posts: 35
Joined: 18 Mar 2012, 04:56

Post » 07 Apr 2012, 16:37

YAY turrets! Good luck finishing!

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 07 Apr 2012, 18:25

fakeuser wrote:
Turtle95 wrote:
Camewel wrote:Take out the bit that says '--rotate back to 0 (portals)' or the turret will eternally right itself and be unkillable.

It crashes if i take that out. BTW that's a comment, it has no effect.
I hope you have figured out yourself he didn't mean the comment, but the code below it

Code: Select all

   --rotate back to 0 (portals)
   self.rotation = math.mod(self.rotation, math.pi*2)
   if self.rotation > 0 then
      self.rotation = self.rotation - portalrotationalignmentspeed*dt
      if self.rotation < 0 then
         self.rotation = 0
      end
   elseif self.rotation < 0 then
      self.rotation = self.rotation + portalrotationalignmentspeed*dt
      if self.rotation > 0 then
         self.rotation = 0
      end
   end

Yea I figured that out. They are killable but they constantly play the shut down. I'll fix that. I wonder if the people at LOVE forms have responded.

User avatar
fakeuser
Posts: 135
Joined: 04 Mar 2012, 01:20

Post » 07 Apr 2012, 20:44

Turtle95 wrote: I wonder if the people at LOVE forms have responded.
I wonder what are you asking them

User avatar
Lawnboy
Posts: 836
Joined: 03 Feb 2012, 02:24

Post » 07 Apr 2012, 21:53

I tried to help on the forums.

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 07 Apr 2012, 22:35

fakeuser wrote:
Turtle95 wrote: I wonder if the people at LOVE forms have responded.
I wonder what are you asking them

Why the laser expects userdata when I draw the laser.

EDIT: Lawnboy, I see what you said there. Would I do the floorcollide:draw inside the box or main?

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 08 Apr 2012, 00:14

Sorry for double post, but one thing guys. I'm going to update the video in a bit. Just lemme hold a small and fun contest. .

Image + Image

Not that exact pic. Just lemme see some epic drawings of the turret  ON FIIIIIRREE! 

User avatar
fakeuser
Posts: 135
Joined: 04 Mar 2012, 01:20

Post » 08 Apr 2012, 00:43

Have tested for some time and I bet lazerimg is nil. That's exactly how I managed to get the "expected userdata" error message. Before drawing the image add a

Code: Select all

print("lazerimg = " .. lazerimg)
and if you get an error like "Trying to concatenate a nil value" then I'm right. You should initialize it in the very beginning of the script file

As for box:draw(). Have you read game.lua? Boxes are part of objects table and are drawn in game_draw() function (that's why drawable and quads are set). If you want to have box:draw() called, then you have to edit game.lua as well or use some injections. Lua is not the brightest language when interceptions are needed, but here's a simple solution (add to box.lua or whatever you renamed it to)

Code: Select all

real_draw = game_draw
game_draw = function()
	for split = 1, #splitscreen do
		love.graphics.translate((split-1)*width*16*scale/#splitscreen, yoffset*scale)
		for j, w in pairs(objects["box"]) do
			w:draw()
		end
	end
	
	real_draw()
end
Then move your drawing logic into box:draw() function. It has no place in floorcollide(). And there is no such thing as floorcollide:draw

User avatar
Turtle95
Posts: 1246
Joined: 21 Mar 2012, 21:48
Contact:

Post » 08 Apr 2012, 02:12

EDIT:

Updated the videos. Still, no lasers. Will get onto that.

YES I did make GLaDOS talk. Made one giant .ogg of the three separate files, put it in sounds, made the sound in main.lua, then played it when you have boxes. . er.. turrets.

EDIT 2:

Good news: Got the lasers drawn.

Bad news: they are not aligned on the turret.


Image

Locked