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 / Sprite Names

Author
Message
Dave47
9
Years of Service
User Offline
Joined: 30th Aug 2014
Location:
Posted: 28th Jul 2016 21:31
Is it possible to return the name of a sprite? Not the auto-created index, but the name used to create it.
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 28th Jul 2016 21:39
Do you mean the filename for the image? If so then yes.


Dave47
9
Years of Service
User Offline
Joined: 30th Aug 2014
Location:
Posted: 28th Jul 2016 22:01
No.
What I want to find is the name of the sprite. Grid[Col,Row] in the code.
I can click on one of the sprite and get the auto-created id. eg. 100001, 100002, etc.

For Col = 1 to 8
For Row = 8 to 1 Step -1
Grid[Col,Row] = CreateSprite(LoadImage("LED.png"))

SetSpriteSize(Grid[Col,Row],50,50)
SetSpritePosition(Grid[Col,Row],Row * 50,Col * 50)

sleep(100)
sync()

Next Row
Next Col
Markus
Valued Member
19
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 28th Jul 2016 22:48
a sprite did not have a name property but u can use your own struct / user defined type.
you mean something like this?
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Mobiius
Valued Member
21
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 29th Jul 2016 10:49
I'm still confused then as sprites don't have names, and your code:

puts the sprite ID into Grid[Col, Row], not a name?
SpriteID = GetSpriteHit( CursorX, CursorY )
haliop_New
User Banned
Posted: 30th Jul 2016 13:51
sometimes my Ents (aka Sprites) types are like this :



so the text is for CreateText
and the TextString is the name of that sprite
then if you hit it using GetSpriteHit(x,y)
it will just SetTextVisible to 1 , and just keep the textposition at the same coordinates as the sprite inside the loop.

Login to post a reply

Server time is: 2024-03-28 20:13:10
Your offset time is: 2024-03-28 20:13:10