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 Chat / [SOLVED] Can I have an example of using Tween Camera?

Author
Message
Creative Magic Man
6
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Frinton On Sea, Essex, UK
Posted: 7th Feb 2019 15:38 Edited at: 7th Feb 2019 15:41
I have been searching on this forum & all over the Net (including YouTube) but I am unable to find any examples to use Camera Tweening. There are no Screen Tweening examples in the Game Creators documentation for commands!

I have managed to get the basic sprite demo of Tweening (in the original directory with the AGK) working OK & I have tried substituting the main Sprite Tweening commands ( as shown below that run OK) for the Screen ones but nothing happens on the screen.

I can work around this problem in my game ( by manually altering the screen coordinates) but I would still like to know (and experiment ) with the Screen Tweening commands.

The commands below are just those that I have substituted for the Screen ones but the code is not the whole code as I only stops working when I substitute the Screen Tweening commands.

// Working Sprite Tween Commands
TweenID=CreateTweenSprite(3)
SetTweenSpriteX(TweenID,0,80,-1)
PlayTweenSprite(TweenID,SpriteID,0)

// Main Loop
do
UpdateAllTweens(GetFrameTime())
Sync()
loop

= = = = = = = = = = = = = = = = = = = = = = = = = = = =

// NONE working Screen Tween Commands
TweenID=CreateTweenCamera(3)
CreateTweenCamera(TweenID,3)
SetTweenCameraX(TweenID,0,80,-1)
PlayTweenCamera(TweenID,1,0)

// Main Loop
do
UpdateTweenCamera(TweenID,1,GetFrameTime())
Sync()
loop
Amazing creations start with a Fuzzy Vision
Dave - Creator, Developer and Visonary
Fuzzy Visions

The author of this post has marked a post as an answer.

Go to answer

Creative Magic Man
6
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Frinton On Sea, Essex, UK
Posted: 7th Feb 2019 16:23
I have come up with an easy workaround (yep, I solved my own problem on here!) for anyone with a similar problem.

Just create an invisible Tween such as a sprite and then copy the relevant information (such as the coordinates) to the screen information.


do
CamPosX#=GetSpriteX(SpriteID) `The SpriteID is the invisible Tween Sprite
SetViewOffset(CamPosX#,0)

UpdateAllTweens(GetFrameTime())
Sync()
loop


Knowing the Screen Tween commands would still be helpful though
Amazing creations start with a Fuzzy Vision
Dave - Creator, Developer and Visionary
Fuzzy Visions
Bengismo
1
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 7th Feb 2019 17:02
This post has been marked by the post author as the answer.
The camera tweens only affect the 3d camera properties. They dont affect where your sprites appear on screen.

Your using SetViewOffset() which isn't a camera so its not the right tween to use. There isnt actually a tween for controlling the ViewOffset so using a spritetween (or a custom tween) to do it is probably the best solution as you have discovered.
Creative Magic Man
6
Years of Service
User Offline
Joined: 14th Nov 2012
Location: Frinton On Sea, Essex, UK
Posted: 7th Feb 2019 19:13
Thanks Bengismo. It all makes sense now
Amazing creations start with a Fuzzy Vision
Dave - Creator, Developer and Visionary
Fuzzy Visions

Login to post a reply

Server time is: 2019-02-20 08:23:53
Your offset time is: 2019-02-20 08:23:53