Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Data.clear() and add Emitter.simulate(time) #144

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jacobalbano
Copy link
Contributor

Incorporates a change to the Data API as discussed here, and adds a method to the Emitter class which allows the passage of time to be simulated for "pre-warming" particles. Demo and discussion here.

public static function clear(filename:String):void {
Data.load(filename);
public static function clear():void
{
_shared.clear();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the desired use of clear() just to flush data in memory and not on disk? I feel this is the best approach, but I just want to make sure it is working as intended.

So, to delete a save file, a user would have to do the following:

Data.load("slot1");
Data.clear();
Data.save("slot1");

@zachwlewis
Copy link
Member

Other than making sure clear() is functioning as intended, this looks good to go.

@jacobalbano
Copy link
Contributor Author

Yep, that's how I intended it to work. My thinking was that all the other data functions work with the currently loaded SharedObject, so clear() ought to as well, plus I can think of times when you might want to clear data and not immediately flush it.

Expanded various checks in FP helper functions to work with Vectors
containing value types
@zachwlewis
Copy link
Member

If I could get another pair of eyes on this, I'd feel comfortable merging it. 👀

/cc @azrafe7 @useflashpunk/librarians

@zachwlewis
Copy link
Member

Also, is ae0e560 part of this pull request? What is that doing? Something with vectors, apparently.

@jacobalbano
Copy link
Contributor Author

I'm still not super good at github so I don't know if that one is included in this pull request. It fixes FP.choose() not working with a Vector of int, uint, or Number. Those types are handled differently in memory, so you can't convert Vector. to Vector.<*>,

Prior to this, passing FP.choose() a vector of ints would result in the whole vector being returned, and sort/shuffle would have no effect.

@zachwlewis
Copy link
Member

Pull requests are used to request the changes in a source branch be pulled into a target branch.

Usually, you'll want to create a branch per feature (I'd name this one "emitter-simulation"), then complete your feature in that branch. Once your feature is complete, or when you're ready to have eyes on it, you would submit a pull request. Then, if changes are made to that branch (like fixing a bug or updating a function definition), those changes are automatically added to the pull request.

If you submitted a pull request from "master" and you committed anything else to it, whenever the pull request is pulled, it'll get those changes as well.

As a rule of thumb, don't submit anything directly to master. Create a branch for the feature you're working on. When it's complete, submit a pull request, pull that feature branch into your master branch, and safely remove your feature branch. This also makes it easier to contribute to other repositories.

On Wed, Jan 21, 2015 at 12:11 PM, Jacob Albano [email protected]
wrote:

I'm still not super good at github so I don't know if that one is included. It fixes FP.choose() not working with a Vector of int, uint, or Number. Those types are handled differently in memory, so you can't convert Vector. to Vector.<*>,

Reply to this email directly or view it on GitHub:
#144 (comment)

@jacobalbano
Copy link
Contributor Author

Gotcha. I'm used to Bitbucket/Mercurial, and pull requests work a little differently over there.

So I should have my own personal fork of Flashpunk, which stays up to date with the official repo. When I make changes, I branch my own repo, and submit pull requests from there?

@azrafe7
Copy link
Contributor

azrafe7 commented Jan 21, 2015

👍 I'm OK with the changes (also agree that Data.clear() shouldn't flush()).

Didn't know about the Vector thing, http://stackoverflow.com/questions/5054418/how-to-test-if-an-object-is-a-vector clarified it.

@jacobalbano
Copy link
Contributor Author

It had me scratching my head for quite some time. I was doing this:

var choice:int = FP.choose(myChoices);

The result was coming up 0 every time when I used a Vector., but it worked fine with arrays. I guess Vectors become 0 when coerced to ints? I dunno.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants