Graphing Redux

Revised and improved version of my previous graphing project.

The main improvement was optimization related, of which would have been difficult to do without a fresh slate. In short, I had a bunch of long spaghetti code in my the old version, that would have just taken way to long to sort out.

So I remade all the actually needed code and simplified it as well. This should also make the project easier to use.

Please feel free to leave feedback/suggestions! All critique is welcomed.

cool project !

Did you know you can do this:
Graphing Redux script pic

No, i did not know that, thank you!


On a side note, I was just about to reach out to you lol.

If its okay for you to ask here, i wanted help with a problem I was experiencing with card engine: After dealing, I’m trying to add a way to “hit” and get another card, but it keeps moving the entire deck into playerHand instead of just one card:

I’ve tried removing the forever loop and even the broadcast, but it still does it. I also tried doing it in a different sprite, still happened. I then did this by itself:

cards engine v2.1 script pic(1)

It produced the same result switching to:

cards engine v2.1 script pic(2)

So, I’m not sure what to do… Honestly starting to go crazy!

Its more than likely a me problem, but your help would be appreciated! Please and thank you!

Here’s the link to that: Graphing Redux by johnce | Snap! Build Your Own Blocks

Very happy to be able to help you

I see the problem…

look at this:


1-when the green flag is pressed, 52 clones (of myself) are created
2-after that you broadcast a message to all (the current sprite and the 52 clones will receive the message.
3-notice the number 53: this script run 53 times (myself and my 52 clones had receivethis message and run the forever loop…
4-when you press e, all the clones transfer a card!

You have 4 choice:
1- You can broadcast to myself like this:


2- You can “filter” when you receive the message like this:

3-no broadcast like this:

4-create a button to trigger the event (all the logic will be in this button…): you can watch my example (in draw button)
If you want tu use a button, go into my project, export the draw button and import it in your project…
image

I believe doing something like this could solve the issue. (The … blocks are for example. Feel free to remove them) here’s an image:


The launch block is very useful in scripts like this.

Thank you again!

I had no clue what the 53 meant, so its nice to know that it means the amount of sprites receiving the message.

I decided to use the “broadcast to myself” method, as there are three other inputs being scanned. I felt that some lag would occur if I tried to filter all of them, and I like using broadcast as it helps make game state more easily read so I’d rather not remove it.

Again, thanks!

No problem !

That’s partially correct: 53 means that this script runs in parallel 53 times. If you remove the infinite loop, you won’t see 53 because the script is executed 53 times, but it stops once it has finished… that’s why you won’t see 53.