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 / [Feature Request] Ability to assign arbitrary values to sprites

Author
Message
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 17th Apr 2014 11:54
Hi,

It would be really nice if we had the ability to add values to sprites, for instance if I wanted to store the health of a sprite I could do something like:



I'm currently doing this manually by scanning through my enemy array and finding the enemy with the sprite ID and checking the health. it's more of a nice thing to have, not essential but things like this make life a lot easier for T1 developers.

All programmers are playwrights and all computers are lousy actors.
Matty H
16
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 17th Apr 2014 12:31
I second this.

User data request

xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 17th Apr 2014 13:14
You need to do a sprite manager with arrays.
Define your type and add the values you want.

Long life to Steve!
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 17th Apr 2014 13:30
Quote: "You need to do a sprite manager with arrays.
Define your type and add the values you want."


This is what I currently do, I have an array of different enemy types, all have their own UDT, which contain a common UDT for global properties. However, say I have 10 different enemy types on a map and there are 10 of each enemy type. That means potentially I have to iterate over 99 array items in 10 different arrays to find the one I'm looking for.

This is inefficient and not very wise. There are other hacky ways to get around this, but they are just that, hacky.

Having an arbitrary attributes/properties tag on the sprite would be ideal. However, as this is not likely to happen, hacky it is!

All programmers are playwrights and all computers are lousy actors.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th Apr 2014 15:04
i had requested long ago a reference "id" as integer in sprite struct.

my idea was:
SetSpriteReference(nSpriteID,index)
index=GetSpriteReference(nSpriteID)
blah[index].health

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 17th Apr 2014 15:16
It's quite easy in C++ or Pascal, because you can sub-class the sprite type.

-- Jim - When is there going to be a release?
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 17th Apr 2014 15:22 Edited at: 17th Apr 2014 15:24
Quote: "It's quite easy in C++ or Pascal, because you can sub-class the sprite type."


I've been thinking about moving over to T2 quite a lot recently. The only reason I've stuck with T1 is that it is super easy to port onto the different platforms, I can also test it on my phone in a couple of clicks.

How hard is to port the code base from Windows to Android and eventually iOS? I'm under the impression that if I stick to the AppGameKit commands and only use libraries that are themselves cross-platform it shouldn't be much hassle. It will be just a case of copying my headers and source files into the new target project, is this correct?

P.S. I have absolutely no desire to use Pascal, I would personally rather chop my hands off and type using my forehead on a keyboard where the keys are rusty nails C++ I used to use on a daily basis a few years ago, so I can move over to this if it's not too much hassle. Due to work and life commitments time is of limited stock, so I'm trying to make this project as painless as possible.

All programmers are playwrights and all computers are lousy actors.
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 17th Apr 2014 15:30
Quote: " I have absolutely no desire to use Pascal, I would personally rather chop my hands off and type using my forehead on a keyboard where the keys are rusty nails "


Good luck, then. Stick with ghastly. Ignore the better.

-- Jim - When is there going to be a release?
monotonic
18
Years of Service
User Offline
Joined: 24th Mar 2006
Location: Nottinghamshire, England
Posted: 17th Apr 2014 15:37
Like I say, C++ would be the way to go for me if it doesn't add too much to the time it takes to port the game to the various platforms. I might give a try tonight and see what it comes up with. I have asked the question about ease of portability in T2 (C++) but I have yet to get an answer, fingers crossed.

I must admit, loosing OOP functionality is a big hit, I'm so used to using it now it feels like I've been handcuffed.

All programmers are playwrights and all computers are lousy actors.
peterJBE
16
Years of Service
User Offline
Joined: 11th Mar 2008
Location: Belgium
Posted: 17th Apr 2014 15:56
I surely second this.
I needed it for every project until now.
I don't think several different properties are necessary.
If the sprite returns a number you can in index in your own array of UDT´s for any associated information.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 18th Apr 2014 04:47
Quote: "The only reason I've stuck with T1 is that it is super easy to port onto the different platforms"

I work in Tier 2 and use the same code in all platforms without an issue. You just have to set up projects for each platform.

If I ever can find the time, I'll finish the tutorial I had started (built into one file which was too large and needs to be broken up) and it shows how to do a lot of cool stuff in Tier 2, including using one set of code in all platforms.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 18th Apr 2014 07:58
This may be a little easier with v2 and being able to pass arrays by reference. But there's still a lot of possible overhead.
I wouldn't get your hopes up for additional commands like this, Paul's pretty buried with everything for v2 from what I can tell. There doesn't seem to be much room for him to do added functionality beyond what is planned for v2 (which a lot of it we're in the dark about).

I'm gearing toward t2 myself because I need a lot more control over my apps and I need the ability to add in SDKs like Google Play Services and extend/fix the capabilities in existing SDKs (FB , Game Center , IAP).

@AL - would you be interested in sharing your tut as it is right now? I mean many of us might have to fumble through, but that's better than nothing. I just spent 3+ weeks on and off learning java stuff so I could implement Chartboost with T1 (and it works!). So I think I could grasp the C++ stuff with a template of sorts.

Yaro
10
Years of Service
User Offline
Joined: 29th Mar 2014
Location:
Posted: 18th Apr 2014 08:52
Quote: "I work in Tier 2 and use the same code in all platforms without an issue. You just have to set up projects for each platform.

If I ever can find the time, I'll finish the tutorial I had started (built into one file which was too large and needs to be broken up) and it shows how to do a lot of cool stuff in Tier 2, including using one set of code in all platforms.
"


If it's any motivation, I'd find that tutorial extremely useful.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Apr 2014 06:57
Quote: "If it's any motivation, I'd find that tutorial extremely useful. "

I actually had it complete and Paul looked at it. But the resulting page was way too long.

So, my effort now (when I can make the time) is to logically break it up into multiple pages with a top level one. I have it started, but have been busy with the new full time job.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 19th Apr 2014 07:01
<-- Only job is to make games
If you want to pass it along to me then I could take a stab at it

Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 19th Apr 2014 21:19
Quote: "If you want to pass it along to me then I could take a stab at it "

Thank you for the offer. But I think this is something I need to finish myself.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 21st Apr 2014 21:29
There's always a place in the newsletter for tutorials like this, it gets it straight out to 20,000+ people.

Login to post a reply

Server time is: 2024-11-25 04:50:09
Your offset time is: 2024-11-25 04:50:09