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 / Make small sprites (like coins) pop up when mouse button is pressed and bounce up then go in random direction downwards, then disappear after a while

Author
Message
Thugnificent
8
Years of Service
User Offline
Joined: 16th Aug 2016
Location:
Posted: 18th Aug 2016 15:56
That was a mouthful.

What i want to do is when i click on a button everytime i click a coin sprite should appear and bounce a little in the air before dropping below. Once at the botton it should dissapear after like 2-3 seconds.

How would i go about doing that? Sorry if i am asking too many questions last couple of days, but i really really appreciate you guys' genius

Cheers!
CumQuaT
AGK Master
14
Years of Service
User Offline
Joined: 28th Apr 2010
Location: Tasmania, Australia
Posted: 18th Aug 2016 16:07
Do you need it to be 2D or 3D? I recently coded up a simplified 3D particle system:

https://forum.thegamecreators.com/thread/217772
Thugnificent
8
Years of Service
User Offline
Joined: 16th Aug 2016
Location:
Posted: 18th Aug 2016 16:08
2D please

or can 3D be implemented in a 2D game?
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 18th Aug 2016 16:09
I'm doing exactly that in my current WIP, using the built-in particles system. I'll post up some code later when I get home.
V2 T1 (Mostly)
Phone Tap!
Uzmadesign
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 18th Aug 2016 22:38
If you want to start really simple, you can use the Tween commands. These automate the transition from one state to another over time.

You can set position and alpha to achieve your effects. The tweens can ease in and ease out for smoother movement.
You can add multiple tweens to a chain so that each one follows the previous one.
Finally you can check if the Tween (or Tween Chain) is playing, and delete the sprite when the sequence ends.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 19th Aug 2016 10:33
Here's my coins function using particles. Note: coinimage must be global.



In your game loop, you can call docoins(x,y, number of coins you want to appear) whenever you want coins to appear. You'll need to tweak the values so the spawned coins do what you want them to do, but you should be able to figure it out.

V2 T1 (Mostly)
Phone Tap!
Uzmadesign

Login to post a reply

Server time is: 2024-09-29 17:34:54
Your offset time is: 2024-09-29 17:34:54