Author Topic: add dynamic sprites  (Read 11787 times)

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
add dynamic sprites
« on: 2007-11-16, 01:57:11 PM »
wanted to try out "add sprite at plan"-method. added a rule at a plan for it. it works fine, so fine that after a few seconds that error occurs: sprite limit of 100 reached.
i guess i have to say "only add one sprite". couldn't find thet "processSprites"-method or "lastCreatedSprite", if they are necessary at all.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: add dynamic sprites
« Reply #1 on: 2007-11-17, 11:59:30 AM »
To make sure that only 1 sprite gets created, you could use a counter or a sprite parameter.  Set the parameter/counter to 1 when you want to create the sprite.  Then make the rule check if the parameter is 1.  If so, then create the sprite and set the parameter/counter to 0.  But then maybe you have the same problem -- how do you set the parameter/counter to 1 only once?  To help you more, we'd need to know more about what you are creating the sprite for.

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: add dynamic sprites
« Reply #2 on: 2007-11-19, 03:14:40 PM »
one suggestion:
when one suspends a rule, all the appendant under-rules should be also suspended.

is there a chance, to give out some text for debugging purporses? i think of sth. like the debugger of flash. when you run it, a window appears beside your flash movie. in the debugger window you can find all objects currently in the movie, and all variables with their values. this would it eventually make easier to find out if a value is set right or wrong and how they change at runtime.
« Last Edit: 2007-11-19, 03:47:16 PM by Morgengrauen »

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: add dynamic sprites
« Reply #3 on: 2007-11-19, 07:42:01 PM »
There are the LogDebugLabel and LogDebugValue rules which output a string or number to the upper-left corner of the display.  An actual window with information on various maps, sprites, plans, etc. would be very helpful, but I think that's probably going to have to wait until 2.1
Edward Dassmesser

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: add dynamic sprites
« Reply #4 on: 2007-11-20, 02:06:37 PM »
oh thanks, that's helpful :-)

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: add dynamic sprites
« Reply #5 on: 2007-11-21, 12:35:33 PM »
bluemonk, what do you think of changing the function/checkbox "suspend rule" to a "suspend this rule including all children"?
i have a rule composed of about 7 children rules, sth is not working and i spent a lot of time with checking and unchecking the suspend box.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: add dynamic sprites
« Reply #6 on: 2007-11-23, 10:31:15 AM »
That would be confusing when looking at the child rules.  What would the state of the box be if some grandparent's checkbox has been checked, and the parent's box has been un-checked?  I think it would be better to have separate buttons to automatically check or un-check the box for all children, but leave the existing checkbox as an indicator for only the current rule.

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: add dynamic sprites
« Reply #7 on: 2007-11-23, 11:33:05 AM »
i haven't so much scripted at all. but i ask myself whether or not it's usefull only to suspend a parent rule without children. because the parent rule is often(?) a condition, and not suspending the children changes the whole structure.
but, you have to know that. however, a checkbox for "suspend this rule including all children" would be very usefull, i think.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: add dynamic sprites
« Reply #8 on: 2007-11-24, 08:08:55 AM »
It's true that suspending a parent rule without suspending the child rule is an odd and uncommon thing to do.  But the way the data is laid out, it's more straightforward in the implementation (and more flexible) to suspend individual rules.  I feel that when a program takes too much control away from the user and tries to be too "smart", it will often have the opposite effect and confuse and frustrate many users in other ways.  But I do see the value in having a shortcut to suspend a parent rule and all child rules.  I think a button (not a checkbox) to suspend or un-suspend all child rules would work well, don't you?  The checkbox would exist as an indicator of whether the current rule is suspended (and chould be toggled), but the button could be used to change it and all the child rules.

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
Re: add dynamic sprites
« Reply #9 on: 2007-11-24, 09:30:18 PM »
What you should really do is have the tree itself contain the checkboxes so you can easily see what's "commented out"
Edward Dassmesser

Jam0864

  • Contributor
  • Fanatic
  • **
  • Posts: 744
    • MSN Messenger - marmalade0864@hotmail.com
    • View Profile
    • Jam0864's Content Dump
    • Email
Re: add dynamic sprites
« Reply #10 on: 2007-11-25, 12:41:17 AM »
yeh thats a good idea.

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: add dynamic sprites
« Reply #11 on: 2007-11-25, 10:14:43 AM »
I think a button (not a checkbox) to suspend or un-suspend all child rules would work well, don't you?  The checkbox would exist as an indicator of whether the current rule is suspended (and chould be toggled), but the button could be used to change it and all the child rules.

i totally agree with you *g*
and, perhaps it would do good for the overview, a suspended rule could be shown automatically in grey text. like a "greyed out" checkbox one can't click. or the text would become italic.
(but i don't know what it would look like on a computer with a non-standard color scheme. maybe the user could customize this color at his wish)

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: add dynamic sprites
« Reply #12 on: 2007-12-02, 01:50:13 PM »
FollowPath:
i noticed there is no parameter how the sprite shall be aligned at the path.

i am curious, blue monk. all that methods like "isInState, GetNearestSpriteIndex" and so on, did you define them at your own? in order to allow people making games with all important functions already predefined by you?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: add dynamic sprites
« Reply #13 on: 2007-12-03, 07:09:26 AM »
FollowPath:
i noticed there is no parameter how the sprite shall be aligned at the path.

That's because the path is only used to determine the sprite's position, so it doesn't need to allow sprites to have different positions relative to the path.  The path can just as easily be defined (or moved) to always indicate the top left corner of the sprite, since it doesn't need to have a particular position for any other purpose.  I suppose it might be a handy feature, but certainly not necessary.

i am curious, blue monk. all that methods like "isInState, GetNearestSpriteIndex" and so on, did you define them at your own? in order to allow people making games with all important functions already predefined by you?

I'm not sure I understand the question, but I think the answer is yes.  If I hadn't defined them, where would they have come from?  (What other answer could there be?)  And they can all be customized too (except the operators like "+", "=" and "<") so you can make them behave however you want.  Every function that has letters in it is a function defined in the SourceCode folder, which can be customized.  There is nothing hard-coded in the IDE for these functions.  They come entirely from the source code folder (you could create your own project template with a very different framework and a completely different set of rule functions with different names and parameters, without changing any of the SGDK2 internal source code).

So back to the first question, you could add a parameter to your project's FollowPath function if you want!

Tanja

  • Clever
  • Fanatic
  • ***
  • Posts: 606
    • View Profile
Re: add dynamic sprites
« Reply #14 on: 2007-12-03, 11:06:33 AM »
you understood my question right.  :)