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.

Newcomers AppGameKit Corner / Best way to create this effect (gif image)

Author
Message
Thugnificent
8
Years of Service
User Offline
Joined: 16th Aug 2016
Location:
Posted: 25th Aug 2016 16:13 Edited at: 25th Aug 2016 16:17
I am looking to make this effect, what is the best way to do this in AGK. I want to create numbers that pop up like that, they will be attached to a float Variable which when increase will show the value in the pop ups.



GIF: http://i.imgur.com/fJbr66B.gifv


On a similar note, how would i make numbers increase incremently, not jumping to other numbers but going 1 by 1 really fast. See gif below.

GIF: http://i.imgur.com/zh3KJOr.gifv

Thanks in advance!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Aug 2016 16:56
1. Use CreateText() to make your text object
2. Make an array of Text Objects so you can have many on screen at once
3. Set the value and position
4. Use the Tween commands to make them rise and fade without having to manually move and fade them each game loop.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 25th Aug 2016 17:06
You'd probably only need 10 text objects, recycle them by using a different text object each time with the new position and string, and add the tweens to fade them out as Batvink suggests.

If you need a code snippet, I'm sure we can come up with something.
The code is dark and full of errors
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 25th Aug 2016 19:53
I did exactly this in my Boxes game.

Here I am setting the text value and position, and starting the Tween



Here is where I create the Tweens and Text. This is a fading of the Alpha and an increase in size, so it looks like it is coming out of the screen.



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Thugnificent
8
Years of Service
User Offline
Joined: 16th Aug 2016
Location:
Posted: 26th Aug 2016 12:17
Thank you so much BatVink and Van B, i really appreciate it. This really helped.

Do you have any clue regarding the 2nd gif effect? I see this effect is implemented in an AppGameKit game called phone tap (on Android), i think it's made by the user CJB here. Maybe he can chime in regarding that

GIF: http://i.imgur.com/zh3KJOr.gifv

Thanks again!
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 26th Aug 2016 13:17
You can achieve the second effect simply by using SetTextString() and putting your current score in the value.

SetTextString(myScoreText, str(MyScore,2))

The last value sets the number of decimal points.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Thugnificent
8
Years of Service
User Offline
Joined: 16th Aug 2016
Location:
Posted: 26th Aug 2016 13:56
That would mean jumps in the numbers. For examply see scenario below:

Variable1 = 5
Variable2 = 20(this will increase Variable1 with 20 every second)

What i want in result is Variable1 = 25 but incremently.

What i currently have is it jumps from 5 -> 25 directly without any numbers inbetween. I hope this clears up what i am trying to achieve.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 26th Aug 2016 18:12
here you go, everything all rolled into one demo...moving, fading, incrementing by 20 every second...

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Thugnificent
8
Years of Service
User Offline
Joined: 16th Aug 2016
Location:
Posted: 26th Aug 2016 18:47
OMG thank you SO MUCH!

I've been trying to do that counting thing for almost 3 days now and was getting pretty frustrated. You're super AWESOM!!!!!!!!!!!!!!!!!!!!!!

THANKS!!!!!!!!!!!!!!

Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 26th Aug 2016 21:53
Nice snippet Steve, only really used the tween stuff in AGKex, but seems pretty damn useful! - cuts out a lot of unnecessary coding too.
The code is dark and full of errors
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 26th Aug 2016 22:06
It could be optimised, but I kept it simple. For example, you only need to update the text when it changes, it is currently doing 60x more work than it needs to.

Quote: " cuts out a lot of unnecessary coding too."

Yes, I wrote a whole set of routines to do this in DBPro, then ported it to AGK. 2,000+ lines of redundant code!
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Aug 2016 22:34
Those of us without tween commands can use this I whipped up.


"I like offending people, because I think people who get offended should be offended." - Linus Torvalds

Login to post a reply

Server time is: 2024-11-22 03:29:31
Your offset time is: 2024-11-22 03:29:31