[Newbies] Question about Etoys Custome Events and Triggering Objects

Jeremy Landry hakyoku at gmail.com
Sun Sep 9 04:42:22 UTC 2018

So after thinking a bit, I decided to take a different route to accomplish
this, though the ending demo is a lot different (I plan on going further
with this, so expect this demo to get bigger until it's something that's
less demo and more 'it's just a fun game' or something to that extent).

At any rate, I was thinking about how Etoys graphics and 'overlaps any'
works and thought about what I'm really after; I don't want to find out
AFTER something happens that two objects are overlapping.  Plus when
detecting whether things overlap, I believe Squeak goes into some maths to
determine areas that overlap etc, which again aren't what I'm interested
in; I'm interested in obstructing movement of objects and knowing which
objects are being 'touched' when obstructing other moving things.

So I went back to the drawing board and didn't use 'overlaps any' at all.
Instead, I decided to think about 'what are the likely ways to eliminate
checking anything at all if I can help it?' So for instance if something is
moving to the right, then I don't need to check things behind it at all and
whether it might touch them.  So from there I began writing some scripts to
that do their best to check only things that absolutely will lead to a
collision; at any point if any of these checks fail, the rest of the checks
aren't performed so that the process can quickly move on to the next object
for inspection of whether the moving object has to be worried about it or

Included is a demo.  It explains maybe in a bit more detail what this can
do. By using this method of checking for touching objects, I can also
detect which side another object was approached from as well. In the demo,
the blocks change color depending on whether they were touched vertically
or horizontally by the 'Hero' object with a simple script (all of the
'walls' are siblings of the object Thing and so editing Thing will send all
of the other walls that functionality too).

Again, I think it performs rather speedy, even my my old 2008 ultra
portable 1.4 Ghz with virtually no video accelleration at all, I'm getting
high frame rates even with checking 18 objects vs. the other try I uploaded
which has many fewer objects and ends up checking a lot more about what is
happening in the playfield and interactions.

Hopefully this is useful to someone and/or ends up becoming something
possibly embedded into the Etoys scripting tiles at some point, though I
cannot realy think of a universal way to put this sort of thing in there
where it's of any use :p


Next I will add clones of the 'Hero' with scripted automated movements to
recreate the tests I already posted and I suspect they will operate much
smoother and more accurately to boot.

On Tue, Sep 4, 2018 at 10:55 AM, Jeremy Landry <hakyoku at gmail.com> wrote:

> I figured out why special events weren't working the way I had them set
> up. In order for the events to be scheduled properly, so to speak, they
> have to occur individually and be taken care of individually.  So instead
> of 'Tell All Contents (SCRIPT)', I used a Do (Number of Objects)
> Times/PlayerAtCursor Do (then event is triggered and handled for a single
> pair of objects)/Cursor IncreaseBy1. This all happens each tick so it
> appears as if it's simultaneous. It's, so far, fastest for dealing with
> collisions, I will post another project soon with demos/examples.
> Also, my copy of Etoys5 starts with 'Custom User Events' checked inthe
> preferences.  I don't ever make changes to etoys friendly options...I'm not
> sure what is going on there...
> On Tue, Sep 4, 2018 at 12:12 AM, Jeremy Landry <hakyoku at gmail.com> wrote:
>> Here's a book of experiments with various ways of implementing 'OVERLAPS
>> ANY (OBJECT)' along with commentary for each experiment. Maybe someone will
>> find it useful. Overall, at least on my slow machine, page 2 seems to
>> perform the fastest. I explain how each of the 7 versions is set up as the
>> idea evolves across the pages.
>> https://drive.google.com/file/d/1JopwojV1KcQar27BkZbrKSjufnk
>> VX9j1/view?usp=sharing
>> I think in the end, having something very specific in mind with regards
>> to motion is probably far more useful than creating 'general behaviors', at
>> least where realtime behavior and many moving objects is concerned. As
>> well, the things I was moving about are a little large compared to what I
>> intend to move since there's a 'pixel limit' per frame which is hardware
>> dependent as well as dependent on whether the screen is being scaled or
>> not. I ran my experiments with no screen scaling at all.
>> If anyone has any further ideas on ways to cut screen update time or
>> further narrow the amount of 'observations' that happen during a single
>> update of all objects on screen, etc. let me know and I will try them out
>> and maybe add them to this book/project for others to learn from and use
>> for their own stuff.
>> On Mon, Sep 3, 2018 at 10:54 PM, Bert Freudenberg <bert at freudenbergs.de>
>> wrote:
>>> On Mon, 3 Sep 2018 at 19:38, Jeremy Landry <hakyoku at gmail.com> wrote:
>>>> What is the intended use for 'triggering object' tile?
>>> I don't know. Never used that tile (it's hidden unless eToyFriendly is
>>> disabled).
>>> Reading the code it indeed is intended to find the object that triggered
>>> that event / script (meaning the object mentioned in the tellAllSiblings
>>> tile).
>>> - Bert -
>>> _______________________________________________
>>> Beginners mailing list
>>> Beginners at lists.squeakfoundation.org
>>> http://lists.squeakfoundation.org/mailman/listinfo/beginners
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/beginners/attachments/20180908/86e468b4/attachment.html>

More information about the Beginners mailing list