playMaker

Author Topic: [SOLVED] ArrayMaker: ArrayList with custom type objects  (Read 2467 times)

DARK_ETERNAL

  • Full Member
  • ***
  • Posts: 110
[SOLVED] ArrayMaker: ArrayList with custom type objects
« on: November 27, 2012, 11:41:34 AM »
Greetings.

This might be a question for Jean Fabre specifically, but anyone who might give me an approach is welcomed.

I'm doing a basic prototype for a battle between players with their own stats, and such. You know what I mean.

Each player has an equipment set, and each piece of equipment is defined in a custom type object. ArrayMaker sounds like the best tool to manage that list of equipment pieces, and any others that might merge, but my question is: How can I manage custom type? I can set the objects as default Object type, but I might need to retrieve the component and cast to my custom type, etc... While I do something alike, has ArrayMaker any other way (hopefully shorter and easier) to manage such kind of objects?

[Update - Nov 27]
I got it working as I suspected. Just adding or getting an "Object" element from the list, storing it in a variable and casting the component with "Get Component" action, then it's possible to me to manage its properties as I need. Marking as solved, although I'd like to read Fabre's (or anyone else's) suggestion, if any different.
« Last Edit: November 27, 2012, 04:07:28 PM by DARK_ETERNAL »
Check out our new game: Nitro Chimp. Now live in App Store!

Trailer:
Download: https://itunes.apple.com/app/nitro-chimp/id557150450?l=en&mt=8

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [SOLVED] ArrayMaker: ArrayList with custom type objects
« Reply #1 on: November 28, 2012, 12:28:13 AM »
Hi,

FsmObject is perfectly valid yes.

 I would tho also consider have a GameObject per type or better said per item, you would gain a practical way to attach these equipments to the player when he wants to use them or parent them back to a listing of unused equipment.

also, using GameObject would give you more freedom to call generic functions to them, with FsmObject, you will have to declare a different variable for each type, unless you start creating inheritances.

bye,

 Jean

DARK_ETERNAL

  • Full Member
  • ***
  • Posts: 110
Re: [SOLVED] ArrayMaker: ArrayList with custom type objects
« Reply #2 on: November 28, 2012, 08:42:05 AM »
Yeah, that's something like I had in mind, although the way I intend to have it working is more generic, since the equipment items only modify the basic stats for my character, but your suggestion, Jean, is more than welcomed. Perhaps I'll find something that might use that advice as well.

Thanks a lot. You're very supportive with your ArrayMaker. I appreciate it.
Check out our new game: Nitro Chimp. Now live in App Store!

Trailer:
Download: https://itunes.apple.com/app/nitro-chimp/id557150450?l=en&mt=8