lolpaca's Recent Forum Activity

  • OK, first of all holy crap that's a lot of complicated maths you had going on there under the shooting AI If you can get it to work that way that's cool, I just tried my lazy way though. After adding a "Last shot distance" to the Text object, I did some testing and noted down some relative angle/distances.

    The furthest you can shoot is 503 pixels at around angle 43 (where 0's the lowest angle possible, 80 the highest). At angle 0, you shoot 124; at angle 80, you shoot 169. I noted down the distances for every 10 angles from 40-80 (since I assume you want your enemies shooting into the air, not straight forward). Then for the enemies, I just used these distances, detected the distance between the 2 ships and set the angle accordingly every 10 increments of angles (adding 185, 180 cos we're firing the other way, and another 5 to get a midpoint).

    Also added the Pin behaviour to your turrets and made the enemy ship a container of them; now every time you add an enemy ship to the layout it'll come with two turrets which are linked to that particular ship, which can be handy! Added another layout called "unused", which is a good place to hold stuff that only exists in containers, otherwise it can mess stuff up on your main layout as it automatically spawns everything associated with that container

    As I said, this is my really scrappy lazy way, the enemies aren't 100% accurate but I think that's more realistic You can probably improve it by figuring out the neat way; ie finding the formula for the curve of the projectiles.

    Hope this helps and good luck with it, I had fun playing with it!

  • Sure, I'll take a look later

  • int(distance(Object1.x,Object1.y,Object2.x,Object2.y))

  • TBH I'd scrap the turret behaviour, you don't need it for this. Do it all in events like a pro

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Incredible R0J0hound, bloody legend you are

  • Basically, there is a relationship between the distance from one ship to another, and the angle the turret needs to be at to score a hit. It's going to take some trial and error and some maths, but you should be able to figure it out.

    One place to start could be to give yourself some input tools so you can adjust the turret angle one degree at a time, and a text object showing how far the projectile has fired - eg When "Projectile" hits "Ocean" -> Set Text to int (distance(Ship.x,Ship.Y,Projectile.X,Projectile.Y)). This will show you the difference that adjusting by one degree makes. Play around with that for a while, record the results, and eventually you'll be able to say "When distance is A, angle should be B".

    Once you've got that down, you can play around with things to make your game more realistic - eg, add a randomiser that increases with distance, so the enemy tends to fire less accurately at long range. The turret behaviour is great and all, but your game's a bit more complicated and it won't take physics like gravity into account for you Good luck with it!

  • I didn't read the comments, though having done so now and seeing some of the stuff that got people annoyed, I have to say I agree with them.

    Personally, I think you should reconsider that stuff. This looks like a great game that you're putting a lot into, and it'd be a shame to have that work go unappreciated because of a disagreement over what constitutes humour.

    Just my 2 cents though, and if as you say you're not fussed about having the game taken seriously, or played by a large number of people, then it is of course your game and your call. I wish you well with it anyway.

  • Whoah, awesome! Just wants a nice fiery explosion on the end

  • Eeee, so pretty! Very nice take on point 'n' click too.

  • Cheers guys

  • Hey Sethmaster, you're in today's RPS!

    http://www.rockpapershotgun.com/2014/05 ... s-m-i-n-t/

    <img src="{SMILIES_PATH}/icon_cool.gif" alt="8-)" title="Cool"> wicked cool, well done!

  • Yeah, the problem is that the turrent behaviour by itself is made for games with a top-down view and doesn't take things like gravity into account, while you're using a side-on view and projectiles that fall - so your enemies are trying to shoot at the most direct path to the player, but the projectiles are falling straight into the ocean

    It's totally doable though - you'll just need to figure out the formula relating distance to angle, then:

    Every tick > set [enemy turret angle] to [whatever angle scores a hit at that distance].

    In the attached .capx, I've created a text object that displays the distance between the player and the enemy ship, and the angle of the player's turret, as well as disabling the enemy movement. If you play around with it for a bit and make some notes you should be able to get a distance/angle formula. (You might want to switch things around so that you're controlling the enemy ship's turrets and the text displays the angle of the enemy ship's turrets, since that's what you're looking for - sorry I did this in a hurry on my lunch break, there's some assembly required )

    Hope this helps!

lolpaca's avatar

lolpaca

Member since 28 Feb, 2013

Twitter
lolpaca has 1 followers

Trophy Case

  • 11-Year Club
  • Popular Game One of your games has over 1,000 players
  • Email Verified

Progress

13/44
How to earn trophies