How do I keep platform enemies from running through barriers

Get help using Construct 2

Post » Tue Apr 26, 2016 12:20 pm

My programming works fine but when my enemies start to move faster they run right through the invisible barriers I have in place. Does anyone have a solution for this?

Also I wanted to include a screen capture but I can't figure out how
B
6
S
1
Posts: 14
Reputation: 375

Post » Tue Apr 26, 2016 12:50 pm

I have a feeling that this is related to https://www.scirra.com/tutorials/67/del ... ence#h2a12 See Minimum framerate section?

At very low framerates, dt can become very large. For example, at 5 FPS, dt is 0.2. An object moving at 500 pixels per second is therefore moving 100 pixels per tick. This can cause it to "teleport" through walls or miss collisions with other objects.

Games are usually unplayable at such low framerates, but it is even worse if they become unstable like that. To help the game stay reliable even at very low framerates, Construct 2 does not let dt get larger than 1/30 (about 0.033). In other words, below 30 FPS, dt stays at 0.033. This does also mean below 30 FPS the game starts going in to a slow-motion effect (described earlier as one of the issues of framerate dependent games), however this is usually a better result than the "teleporting objects" problem.

If you want to set a different limit to 1/30, you can use the system action Set minimum framerate.


For your case, I believe that the game runs fast enough, but since you mentioned the enemy move faster, I have a feeling that they might be moving so fast that they just "teleport" through the walls. Could you see whether this is indeed the case?


For Screen Capture, you can use Snipping Tool. Windows should come with it. But I believe video capturing might be needed more in this case?
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Tue Apr 26, 2016 1:43 pm

Somehow I couldn't load your capx. Can you try that again, but change "https://" to "abcde://" so the forums won't parse that as a link and shrink it?
I got a game that you multiply, breath fire with two heads and brawl foes to oblivion with your clones: http://www.newgrounds.com/portal/view/660664 (use Chrome on Windows for best performance)

My sites:
http://twinblazar.deviantart.com
http://twinblazar.newgrounds.com
https://twitter.com/twinblazar
http://www.pixiv.net/member.php?id=15072448
B
30
S
11
G
11
Posts: 411
Reputation: 8,469

Post » Wed Apr 27, 2016 12:39 pm

drive.google.com/open?id=0B3paAL-Ct0pqQ2NDRnJrNms4dlk
B
6
S
1
Posts: 14
Reputation: 375

Post » Wed Apr 27, 2016 12:41 pm

Ok when I tried to put "abcde" the form would not post the reply? I just took the "https://" and it let me post. I tried to put the address in my earlier post yesterday and the post got deleted. I guess the forum does not like the abcde?
B
6
S
1
Posts: 14
Reputation: 375

Post » Wed Apr 27, 2016 9:50 pm

Okay. This is NOT a copy of your layout. The platforms are placed differned. Because. Wel.

https://
drive.google.com/open?id=0B1SSuCVV8v74ckRIUmtfbDhIVDQ

I wanted to show you the difference in performance when you use a tilemap. I put all the platform sprites in 2 tilemaps. A solid and a jumptrue. Before it ran at 20 FPS on my computer. Now it runs at 65 FPS.

Also, i gave all off screen enemy's a zero timescaling. This is not neccensary. It is just a gimick to lower the collissions/frame even more.

About Choppy not wanting to turn direction on a collision. Wel, wat you try is tricky.
You move Choppy with the platform behaviour, wich is fine, but since the barriers are non-solids; the Platform behaviour is pushing Chappy into the barriere. Normaly when u look for collisions you use a way of moving things that have a auto-push-out-of-solids feature. Without that the collision is gone to quick. You cant make the barriere solid, i know that.

Also, there was a minor picking problem. The chance that 2 choppys needed a direction change at practical the same time was big. But only one got changed.

In the capx is a very elegant solution. It is a fast one too. How smaller the angle, how smaller the range, how faster. And if you tweak it right, it will never miss. Not even at very high speeds or low framerates. It will change a 1000 choppys in direction at the same time too.

Hope i helped you some.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Apr 28, 2016 12:05 pm

Thanks for the help I'll have to play around with your ideas

little background of what I'm doing I got to teach and create an animation and video game design class at my high school since the guy that normally teaches the art/tech stuff didn't have room in his schedule. I start by having the students make a top down shooter which they have a lot of success with. The platform jumpers come out well but there are more glitches I have to figure out. I have a ceramics degree so the computer stuff is out of my area so thanks for you feedback.
B
6
S
1
Posts: 14
Reputation: 375

Post » Thu Apr 28, 2016 12:22 pm

ysvw
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, cb130felix, Kermad, nyuszi008, yiuyiu6666 and 8 guests