Turrets -- v1.4 RELEASED [Both Directions!]
IMPORTANT UPDATE! VERY! So, please excuse this.
Win. Got it working!
Win. Got it working!
Are you going to replace the laser, or are you using that one? Because they're a lot skinnier than that.
Exactly what he said. It's great you got it working, but the laser doesn't fit that turret sprite (or any of the other ones that were posted on the previous page for that matter).Pyr0saur wrote:Are you going to replace the laser, or are you using that one? Because they're a lot skinnier than that.
I'll see what I can do. It's the scale that donnit. I'll first let the x value of the laser increase when the turret "sees" you. I wonder how..idiot9.0 wrote:Exactly what he said. It's great you got it working, but the laser doesn't fit that turret sprite (or any of the other ones that were posted on the previous page for that matter).Pyr0saur wrote:Are you going to replace the laser, or are you using that one? Because they're a lot skinnier than that.
Hey guys, guess what just happened?
Awesomeness. Epic Win.
EDIT: Right now, they aren't dying.. or being picked up. I shall fix this.
Awesomeness. Epic Win.
EDIT: Right now, they aren't dying.. or being picked up. I shall fix this.
Not entirely. They slide .. Dunno why. But once I can place them using the edited entities.png then I can fix it.Maurice wrote:You copied the laser code for the turrets?
This is not going to work.
........will do. Look I'm just trying my best. So, no offense, you don't have to be a jerk like that.Maurice wrote:They slide because you copied the box code.
No the problem is that the lasers work on a block basis. You'll probably need to use traceline (a function I wrote for you! Hooray) for the turrets.
He even wrote some code for you... How is that jerkish? And you should not really copy all the lasers code. All you need was the updaterange part. And if I'm correct now you will need only the traceline functionTurtle95 wrote:So, no offense, you don't have to be a jerk like that.
I meant that because he was like "hooray" in a rude way.Camewel wrote:He's not being a jerk, he's pointing out what you did wrong and giving you advice on how to fix it. If anything, you're being a jerk here. What else could you ask for?
Being slightly sarcastic whilst helping someone still makes you helpful. Just because Maurice doesn't have a shining record of helpful behaviour doesn't mean you can instantly assume he's being a dick. That's simply wrong and unfair.Turtle95 wrote:I meant that because he was like "hooray" in a rude way.
You are the worst judge of yourself possible, you are utterly biased. Therefore, you formulate your opinion on who you are based on what other people have said about you. It's unavoidable human nature.jmv3597 wrote:no one should really ever care about anyone else's opinion about themselves anyway
It was twice only. Not doing it anymore. Maurice, you are an awesome person, honestly. I don't want to have you or Saso hate me for any reason. As I said, I'm just trying my best.Maurice wrote:I'm sorry I lost all respect from you when you said "firin mah lazor". And then again. And again.
..Right.
Anywho, I have decided to open doors to anybody who would like to help. Seriously.
Anywho, I have decided to open doors to anybody who would like to help. Seriously.
It's not one hit kill. But, I am hammering out a few things. Such things are laser deaths and the grabbing.Camewel wrote:I do like how they work right now. It's a good design choice to make it fit more with Mario's one hit kill thing.
I have yet to fix it :DCamewel wrote:Hey wait no I know what you've done here. You just reskinned a bullet bill as a laser. As much is evident by the fact that bullet bill launchers now fire lasers and that you can jump on lasers.
Yep, another thing.Camewel wrote:By the way, the turret's height isn't calibrated properly, so you can jump and land inside the turret and it looks weird.
Turret does not get disabled when tilted and still shoots at Mario. Turret corpse is hostile. There's a bug in your love file - some of the entities are shown as EMPTY in level editor and hitting bricks with head is deadly if there is laser nearby (but not colliding Mario). I like the outcome though
Thx. Idk whats with the blocks doing that. EMPTY was on purpose.fakeuser wrote:Turret does not get disabled when tilted and still shoots at Mario. Turret corpse is hostile. There's a bug in your love file - some of the entities are shown as EMPTY in level editor and hitting bricks with head is deadly if there is laser nearby (but not colliding Mario). I like the outcome though
Oh.. this entity list must be from some other version of Mari0. Does it still work though? Also, I'm trying to have gel collide with turrets. Any thoughts on that?fakeuser wrote:well I was using the gel overlay enitity... And now it gets displayed as empty in editor (normal in game though)
Yes, gel overlay tiles still work as expected and are drawn properly. Even the description in level editor is as it should be. They are only displayed as EMPTY in level editor mode.
For the gel part - well... you could set their y speed to something and shut them down... or something like it.
Just noticed - you have to be kidding... turret.lua and turretL.lua? Haven't you thought about the possibility to just mirror the image? Try
to mirror the image
For the gel part - well... you could set their y speed to something and shut them down... or something like it.
Just noticed - you have to be kidding... turret.lua and turretL.lua? Haven't you thought about the possibility to just mirror the image? Try
Code: Select all
self.dir, self.animationdirection = "left", "left"
That would help.. alot. Also, I can't pick turrets up unless they have been in the air or rotated.fakeuser wrote:Yes, gel overlay tiles still work as expected and are drawn properly. Even the description in level editor is as it should be. They are only displayed as EMPTY in level editor mode.
For the gel part - well... you could set their y speed to something and shut them down... or something like it.
Just noticed - you have to be kidding... turret.lua and turretL.lua? Haven't you thought about the possibility to just mirror the image? Tryto mirror the imageCode: Select all
self.dir, self.animationdirection = "left", "left"
function mario:pickupturret(turret)
self.pickup = turret
end
Code: Select all
function mario:dropturret()
self.pickup:dropped()
local set = false
local turretx = self.x+math.sin(-self.pointingangle)*0.3
local turrety = self.y-math.cos(-self.pointingangle)*0.3
if self.pointingangle < 0 then
if #checkrect(self.x+self.width, self.y+self.height-14/16, 14/16, 14/16, {"exclude", self.pickup}, true) == 0 then
self.pickup.x = self.x+self.width
self.pickup.y = self.y+self.height-14/16
set = true
end
else
if #checkrect(self.x-12/16, self.y+self.height-14/16, 14/16, 14/16, {"exclude", self.pickup}, true) == 0 then
self.pickup.x = self.x-12/16
self.pickup.y = self.y+self.height-14/16
set = true
end
end
if set == false then
if #checkrect(self.x+self.width, self.y+self.height-14/16, 14/14, 14/16, {"exclude", self.pickup}, true) == 0 then
self.pickup.x = self.x+self.width
self.pickup.y = self.y+self.height-14/16
elseif #checkrect(self.x-12/16, self.y+self.height-14/16, 14/16, 14/16, {"exclude", self.pickup}, true) == 0 then
self.pickup.x = self.x-12/16
self.pickup.y = self.y+self.height-14/16
elseif #checkrect(self.x, self.y+self.height, 14/16, 14/16, {"exclude", self.pickup}, true) == 0 then
self.pickup.x = self.x
self.pickup.y = self.y+self.height
elseif #checkrect(self.x, self.y-14/16, 14/16, 14/16, {"exclude", self.pickup}, true) == 0 then
self.pickup.x = self.x
self.pickup.y = self.y-14/16
else
self.pickup.x = self.x
self.pickup.y = self.y + 14/16
end
end
for h, u in pairs(emancipationgrills) do
if u.dir == "hor" then
if inrange(self.pickup.x+6/16, u.startx-1, u.endx, true) and inrange(u.y-14/16, boxy, self.pickup.y, true) then
self.pickup:emancipate(h)
end
else
if inrange(self.pickup.y+6/16, u.starty-1, u.endy, true) and inrange(u.x-14/16, boxx, self.pickup.x, true) then
self.pickup:emancipate(h)
end
end
end
self.pickup = nil
end
Code: Select all
function mario:use()
if self.pickup then
if self.pickup.destroying then
self.pickup = false
else
self:dropbox()
return
end
end
if self.pickup then
if self.pickup.destroying then
self.pickup = false
else
self:dropturret()
return
end
end
local xcenter = self.x + 6/16 - math.sin(self.pointingangle)*userange
local ycenter = self.y + 6/16 - math.cos(self.pointingangle)*userange
local col = userect(xcenter-usesquaresize/2, ycenter-usesquaresize/2, usesquaresize, usesquaresize)
if #col > 0 then
col[1]:used(self.playernumber)
end
end
It has Turretquad (fixed) and the same update for the parent value.fakeuser wrote:To pickup a turret only a simple AABB collision logic is used... So my guess is you have not adjusted x, y, width, height of the turret properly. That is most likely correct as Camewell already told you about falling INTO the turret
Code: Select all
function turret:update(dt)
if time <= 0 then
playsound(Explode)
time = 16
end
self.timer = self.timer + dt
if self.timer > self.time and self.x > splitxscroll[1] and self.x < splitxscroll[1]+width+2 then
if self:fire() then
self.timer = 0
self:randomtime()
end
end
if time <= 0 then
playsound(Explode)
time = 16
end
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
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
- Mari0Lu1g1
- Posts: 347
- Joined: 10 Mar 2012, 12:08
Just asking, can't you make it rapid fire bullets, I can sprite them for you, and the collision against blocks.
It'd be great for Bullet Time!
It'd be great for Bullet Time!
I'm gonna. I just need to fix a few other things :DMari0Lu1g1 wrote:Just asking, can't you make it rapid fire bullets, I can sprite them for you, and the collision against blocks.
It'd be great for Bullet Time!
- Mari0Lu1g1
- Posts: 347
- Joined: 10 Mar 2012, 12:08
Great! If you need any help just askTurtle95 wrote:I'm gonna. I just need to fix a few other things :DMari0Lu1g1 wrote:Just asking, can't you make it rapid fire bullets, I can sprite them for you, and the collision against blocks.
It'd be great for Bullet Time!
Also another suggestion:
Some Turrets have the laser except they try to follow you, I know that would require directional sprites. I'd be more then happy to provide them
Please explain a bit more. Also just made em more rapid, but there's a two second delay after five shots. Is that ok?Mari0Lu1g1 wrote:Great! If you need any help just askTurtle95 wrote:I'm gonna. I just need to fix a few other things :DMari0Lu1g1 wrote:Just asking, can't you make it rapid fire bullets, I can sprite them for you, and the collision against blocks.
It'd be great for Bullet Time!
Also another suggestion:
Some Turrets have the laser except they try to follow you, I know that would require directional sprites. I'd be more then happy to provide them
HELL YEA!Camewel wrote:You can make there be no delay. Just open up variables.lua and change maxbulletbills to 100
No. That'd affect bulletbill.lua. I'll just make laserlimit = 100. Then muahaha.. and all..
Mari0Lu1g1 wrote:Great! If you need any help just askTurtle95 wrote:I'm gonna. I just need to fix a few other things :DMari0Lu1g1 wrote:Just asking, can't you make it rapid fire bullets, I can sprite them for you, and the collision against blocks.
It'd be great for Bullet Time!
Also another suggestion:
Some Turrets have the laser except they try to follow you, I know that would require directional sprites. I'd be more then happy to provide them
How's this?
Leg's aren't good in black BG.. Ah well
EDIT: I'm trying to fix the turrets up a bit. Now, the offset had to be changed (to make Mario stand on them properly) and I changed the #/16 in mario:turretdropped()
to 28/16.
The turret still falls in the floor..
I'm gonna fix that. I was thinking about that a while ago..fakeuser wrote:Your screenshot shows a possible glitch - the topmost turret's laserbeam passes through solid brick.
Hey, at least they are turrets. Cut me a bit of slack. I'm at least trying. Better than NOT doing it. No offense, Maurice. It's your game and you don't want turrets anyway.Maurice wrote:This has nothing to do with turrets anymore.
It's movable bulletbills.
Here's some ideas to make this not terrible:
- Loop through every player sorted by distance, call a traceline in the direction of the player (math.atan2 to get the angle). Calculate the distance to the resulting point and the distance to the player (pythagoras), if the player is closer we can assume he is in line of sight. Only do this every X milliseconds though because traceline is heavy on the math. That way we already have the angle and distance (for laser drawing) too.
- Use a seperate graphic for the "arms" so they can rotate
- When having a target, increase timer up until X, when not, decrease it to 0. When the timer is at X, the turret will have adjusted its aim 100% and starts shooting
- Shots should be a new class that are not physics bound. They should carry a payload with their already calculated hitpoint (wall, player, other) and call a function after they reach their target (see portal projectiles)
- Just assume that if abs(speedx) is > Somevalue and the turret is on the ground, it should fall over. There's a handy self.rotation value for that.
- Loop through every player sorted by distance, call a traceline in the direction of the player (math.atan2 to get the angle). Calculate the distance to the resulting point and the distance to the player (pythagoras), if the player is closer we can assume he is in line of sight. Only do this every X milliseconds though because traceline is heavy on the math. That way we already have the angle and distance (for laser drawing) too.
- Use a seperate graphic for the "arms" so they can rotate
- When having a target, increase timer up until X, when not, decrease it to 0. When the timer is at X, the turret will have adjusted its aim 100% and starts shooting
- Shots should be a new class that are not physics bound. They should carry a payload with their already calculated hitpoint (wall, player, other) and call a function after they reach their target (see portal projectiles)
- Just assume that if abs(speedx) is > Somevalue and the turret is on the ground, it should fall over. There's a handy self.rotation value for that.
Sure, I'll do that. But I'm kinda in the middle of fixing picking up these turrets. They only pick up after being portaled..Maurice wrote:Here's some ideas:
- Loop through every player sorted by distance, call a traceline in the direction of the player (math.atan2 to get the angle). Calculate the distance to the resulting point and the distance to the player (pythagoras), if the player is closer we can assume he is in line of sight. Only do this every X milliseconds though because traceline is heavy on the math. That way we already have the angle and distance (for laser drawing) too.
- Use a seperate graphic for the "arms" so they can rotate
- When having a target, increase timer up until X, when not, decrease it to 0. When the timer is at X, the turret will have adjusted its aim 100% and starts shooting
- Just assume that if abs(speedx) is > Somevalue and the turret is on the ground, it should fall over. There's a handy self.rotation value for that.
Also, how shall I go about finding the player's X and Y.
I could make a getX() and getY() in mario.lua .. no wait.. thinking java..
Isn't that if it's in mario.lua? Uh.. Lemme think here..Camewel wrote:What on earth do you mean "how do I go about finding the player's X and Y" they're stored in variables that you can easily access.