Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Camera zooms out based on player speed

Author
Message
Midget Blaster
AGK Developer
7
Years of Service
User Offline
Joined: 7th May 2016
Location:
Posted: 28th Dec 2017 23:54
Hi I'm trying to add something into my game that zooms out the camera the faster the ball moves, and zooms in if it slows down. This is what I managed to make.



So to explain:

Variable Declaration


This is a formula that checks the distance between two objects.


This is a timer that every 1/100th of a second teleports to the balls current position and saves the speed at which the ball is going at.


This here processes the current speed as a float for how far the game should zoom out, as well as setting the view and adding a limit


Yes I know to more experienced people this may seem like an absolute disaster, but we're all here to learn.
If anyone has a solution, or has created this before in their own code I would be super thankful if someone could help me out.
Thank you.
Midget Blaster
AGK Developer
7
Years of Service
User Offline
Joined: 7th May 2016
Location:
Posted: 30th Dec 2017 19:39
Still trying to find a solution, any help at all is appreciated
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 1st Jan 2018 23:04 Edited at: 2nd Jan 2018 01:53
i made a example based on current speed.
(ups, rename to magnitude)
AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : AMD (17.12.1) Radeon R7 265 : Mac mini OS High Sierra (10.13)
nonom
6
Years of Service
User Offline
Joined: 12th Nov 2017
Location: Picking mushrooms
Posted: 2nd Jan 2018 00:15
I was looking for zooming like this

Thanks for sharing!
Midget Blaster
AGK Developer
7
Years of Service
User Offline
Joined: 7th May 2016
Location:
Posted: 2nd Jan 2018 11:17
I've been playing around with that trying to understand it, it looks great. Is there any way I can incorporate this into physics based objects? the "ball" in my game is a physics object, so do I replace the ball.sx and ball.sy with getspritex() & getspritey()?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 2nd Jan 2018 12:26
for 2d you have
GetSpritePhysicsAngularVelocity ( iSpriteIndex )
GetSpritePhysicsVelocityX ( iSpriteIndex )
GetSpritePhysicsVelocityY ( iSpriteIndex )
AGK (Steam) V2017.12.12 : Windows 10 Pro 64 Bit : AMD (17.12.1) Radeon R7 265 : Mac mini OS High Sierra (10.13)

Login to post a reply

Server time is: 2024-04-20 11:52:48
Your offset time is: 2024-04-20 11:52:48