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 / Can you set the phsyics on a button?

Author
Message
ChoppingLemons
11
Years of Service
User Offline
Joined: 25th Sep 2012
Location:
Posted: 1st Oct 2012 03:13
If you read the title then you know my question
Hodgey
14
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 1st Oct 2012 04:07
I don't think you can directly but you could possibly create a dummy sprite, apply physics to that and then set the coordinates of the button to that of the dummy sprite.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 1st Oct 2012 10:12
I need input... What exactly are you trying to do?

You can't add physics to a virtual button but you could create a physics sprite and use it like a button.


this.mess = abs(sin(times#))
Impetus73
12
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 1st Oct 2012 15:49
Buttons, are not part of the "game world" they are a put-on-top user interface, for devices who lacks physical buttons.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
ChoppingLemons
11
Years of Service
User Offline
Joined: 25th Sep 2012
Location:
Posted: 2nd Oct 2012 18:31
baxslash I'm trying to make a menu that will allow a player to control the main character and by touch buttons will activate the buttons function.( instead of the player touching the button with his finger, he will be touching the button with the main character.)

but what I gathered from this thread is that I need to make a dummy sprite and place it over the button. Knowing this I think I'll design my own buttons and import them has picture and set up the physics and the collision.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 2nd Oct 2012 18:33
Yes, that should work.


this.mess = abs(sin(times#))
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 2nd Oct 2012 23:32
Quote: "but what I gathered from this thread is that I need to make a dummy sprite and place it over the button.
"


The sprite replaces the virtual button, rather than overlaying it. I prefer this method (I don't use virtual buttons) because it is so much more flexible.

ChoppingLemons
11
Years of Service
User Offline
Joined: 25th Sep 2012
Location:
Posted: 3rd Oct 2012 17:23
Thanks for all the help guys.
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 5th Oct 2012 15:45
As AppGameKit have the Virtual Buttons but they can't have physic and they must be max 12 you can do what i done from the begin.
- Do an array struct called buttons
- Give a image for pressed and normal
- do a for in the loop that activate only if touch is pressed
- do a for that activate only if the button pressed is released
- fire the event for the button

Do what you want on this sprite with physic.

Long life to Steve!

Login to post a reply

Server time is: 2024-05-06 21:13:00
Your offset time is: 2024-05-06 21:13:00