Grapjas's Forum Posts

  • 5 posts
  • So here is the thing.

    My game involves turrets. However, when there are 5 turrets within a certain preset range (priority nearest) of eachother, i want the player to be able to promote them by tapping a sprite that will then appear.

    I can't figure out how to store or even pick the nearest object within that range and make them count properly. what comes after that is no problem at all.

    I should also note that the turrets are all the same sprite (for that type of turret).

    Thanks in advance for any help.

    • Grapjas
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dist*dt would make the player move at the maximum speed of 5 pixels per second, which is quite slow to say the least. That's why multiplying by 60 beforehand is necessary so everyone playing would have the player move at 300 pixels per second. (Roughly equivalent to not using dt and moving by 5 pixels per tick at 60fps)

    You're a champ, i misunderstood you in your first post. i thought *60 *dt would set a single movement speed, rather than having the precise movement. It works excactly how i need it to now, your code worked perfectly. Thank you.

    One more question though, how do i give rep?

    Anyway this case is solved.

  • I failed to mention something. Dist is calculated by an event.

    Every tick

    So i guess thats where the hard part comes in. Or maybe not, but i don't know the solution.

    Dist is calculated by the distance the movestick has from movering's center, devided by 12. Clamp makes the limits 0 to 5. I did /12 because when you have the stick around the visual moving ring, you are at full speed (dist 5).

    I did movement like this so that you can move very precisely (slower or faster obviously). i tried move dist *dt. which makes the player move extremely slow.

  • Thank you for your fast reply. I will test this in a bit.

  • Hi all,

    I'm having some issues with my project. I'm fairly sure that it's dt related, but i can't figure out where to put, or how to put it. The problem is probably that my game runs at 30 fps or lower on my mobile device, which makes the player movement look slowmotion while everything else is running normal speed. But the game runs 60 fps on my laptop. This is strange because they both have nearly the same specs. My Phone is huawei Y6 (2gb ram) (quad core), laptop is Medion akoya E2215T (2gb ram) (quad core). on both devices my cpu uses around 40%, 50 at it's highest.

    But since i don't know the GPU specs of both, im guessing it might be related to that.

    I've did alot of research about optimizing your game and did about all of them...Still can't figure it out.

    I've changed sprite sizes to fit accordingly of what they should be on the layers.

    I do not use any physics at all.

    I do use alot of sprites, but they are not big and around 90% do not need heavy calculation or every tick events.

    All sprites not on layout are properly destroyed, and only created when needed.

    That's just a few i can recall, but i did more.

    However, my event sheet is a long one, but i need everything that is in there. Already cleaned it as much as i could.

    Alright i'll show how my movement works.

    Movement

    Aiming and shooting

    Layout view of aim and movesticks, with move and aim rings aswell

    So my guess is, there needs to be a dt somewhere. Because on the laptop the movement is perfect (60fps), but on Phone slowmotion (30fps). I should also note that on iPhone 6s it worked really smooth aswell, did not do a debug test, but im sure it was around 60fps. I preview on wifi to my Phone, and sometimes intel xdk. Both show same performance though.

    Thanks for any help in advance.

    • Grapjas
  • 5 posts