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 / Clicking sprites and 1.07

Author
Message
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 10th Apr 2012 20:40
Hi guys, its me again with another question: So I have got code pretty much sorted out except for this menu screen which I am having problems with, I cannot seem to make some code to allow me to click the buttons (sprites with a button texture) and it is really annoying me now, if you have a solution that I can understand please share. I have looked at the help documentation but the code there does not work for me and the santas bad little elf example is too advanced for me to understand..

One last thing: what is all this hubbub about the new 1.07 patch? Is it only going to be free for us that have already purchased AppGameKit or will it be free for all? in that case I must admit that I am a little annoyed that I didnt just wait for this patch :/

thanks again

//Anton
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 10th Apr 2012 23:21
Here's a little snippet for ya'



Put that in a Do Loop and then you can test if spriteTouched is equal to any of your sprite numbers, and do the appropriate action.

The ScreenToWorldX() and Y() is optional, but can be used if you have moved your world view "camera" around.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 10th Apr 2012 23:52
Paronamixxe, 107 will be free for all users who bought AppGameKit!

If you don't buy AppGameKit you can only use the limited demo.
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 10th Apr 2012 23:52
Quote: " what is all this hubbub about the new 1.07 patch? Is it only going to be free for us that have already purchased AppGameKit or will it be free for all? in that case I must admit that I am a little annoyed that I didnt just wait for this patch :/ "

There's a patch coming out? where'd you hear that?

Yes it's free for everyone that has AGK.

If not there'll be an angry mob with torches storming TGC castle.
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 10th Apr 2012 23:53
Marl, I think the mob is angry right now. when 107 comes out all will be very happy and the board will be silent for days as everyone will be busy coding!!!
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 11th Apr 2012 16:16
Ok, thanks guys, but one thing: I donot give my sprites numbers, I refer to them using a name will this still work? Or do I have to use numbers?

//Anton
bjadams
AGK Backer
16
Years of Service
User Offline
Joined: 29th Mar 2008
Location:
Posted: 11th Apr 2012 16:54
Paronamixxe, names or numbers it works the same
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 11th Apr 2012 16:55
No, Rich, your code doesnt seem to work :/ I donot know why but when I click nothing happens, ill send you my code if you want and you can have a look?

//Anton
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 11th Apr 2012 17:04
Doesnt work for me at all :/ If you guys want to have a look at my code give me a shout!

//Anton
kamac
13
Years of Service
User Offline
Joined: 30th Nov 2010
Location: Poland
Posted: 11th Apr 2012 17:32
Quote: "Marl, I think the mob is angry right now. when 107 comes out all will be very happy and the board will be silent for days as everyone will be busy coding!!!"


Nope, It'll get flooded with questions.

Quote: "Paronamixxe, names or numbers it works the same"


With the exception that names are also numbers, but names are actually variables storing integral values ( which is numbers ).
When you use a name, AppGameKit finds some spare number and assigns it to it. Simple as that.

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 11th Apr 2012 17:37 Edited at: 11th Apr 2012 17:39
Paronamixxe, I'm assuming by 'name' you mean either that you store the result from the CreateSprite command in a variable or that you use a defined constant and supply that as the CreateSprite command.

A code snippet of what you are trying that doesn't work would help us help you.

Cheers,
Ancient Lady
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 11th Apr 2012 18:24
Ok, I use the following code when I am creating a sprite (I renamed it to 1 after it didnt work when I used: playbtn = createsprite (loadimage("blahblahblah")))


//Anton
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 11th Apr 2012 18:25
And the following when I am asking if it has been pressed (this is within a select value and then a case)(I just use the end command to see if it works)


//Anton
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 11th Apr 2012 18:27
It is probably worth noting that I define spritetouched before the do loop with


//Anton
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 11th Apr 2012 18:38
Well, you create the sprite with an id of 1 and then you compare spritetouched to 2.



That might be your basic problem right there.

Cheers,
Ancient Lady
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 11th Apr 2012 18:47
:/ You dont think that I have another sprite called sprite 2 and that I only showed you one of the sprites as an example.....

//Anton
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 12th Apr 2012 01:57
Well when you show us example code using sprite 1, and more code using sprite 2, you expect us to be mind readers and guess you were deliberately referring to the correct sprite??

However, I'd use the GetSpriteHitTest command. (Simple code adapted to do what you wanted)...



"here is a an expression to remember - He who has the gold makes the rules."
Paypal disagreed!
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 12th Apr 2012 15:27
Thank you so much that works!!
Sorry for the bitter tone earlier, I was just getting annoyed that such a small thing was between me and my game!

Thanks again guys!

//Anton
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 12th Apr 2012 21:12
Quote: "Thank you so much that works!!"

The code I gave? If so, then glad I could help! If not, then glad they could help! LOL

"here is a an expression to remember - He who has the gold makes the rules."
Paypal disagreed!
Paronamixxe
AGK Bronze Backer
12
Years of Service
User Offline
Joined: 10th Feb 2012
Location: Sweden
Posted: 12th Apr 2012 22:22
Yeah, the code that you gave me If you guys want I can post a link to the game when I'm finished but thats your call.

//Anton
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 12th Apr 2012 23:27
Why not!

"here is a an expression to remember - He who has the gold makes the rules."
Paypal disagreed!

Login to post a reply

Server time is: 2024-05-08 05:30:12
Your offset time is: 2024-05-08 05:30:12