alice-teacher Alice 3.5 Terminating Without Error (Attached File)

Donald Slater dslater at andrew.cmu.edu
Tue Jun 25 15:26:13 EDT 2019


Bill,
I think I have identified the problem… The student program you sent me was using the isCollidingWith function in the procedure EnemyColliding… He was doing this instead of using a Collision listener.

When I took the functionality of that procedure and moved it into a collisionStartedListener in the initializeEventListeners tab, the crashing problem seemed to go away… I have attached a copy of my solution with this change. The code is somewhat messy and can be cleaned up and simplified.

The key in using the collision listeners is that you define two sets (arrays -> SThing[]) of objects. For me, SetA will contain the “colliders”, those objects that will (in my mind) initialize the collision, in this case the teenPersonHero. SetB will then be the targets (in this case, the three birds). There are times when the colliders and targets will be exactly the same.

You then must determine which of the targets has been collided with

	if thingFromSetB == falcon

for example,

and then you build the response to the collision…

Because there is so much repetitious code in the collision response in this project, I would probably have built a method that handled everything, and passed the appropriate bird as a parameter. I did not know if you had covered parameters in your class, so I left this as is.

This is a pretty cool project, by the way, and playing the game for debugging purposes was not tedious ;-)

Also, thank you for helping us identify the potential problems of using the event functions outside of the listener space.

I suspect that these can be used in a one-off type of situation in a project, but trying to use them as your student did (in a while loop instead of using a listener may be problematic.

Thank you, and all the best,

Don Slater

Alice Project

-------------- next part --------------
A non-text attachment was scrubbed...
Name: UsingCollisionListener.a3p
Type: application/octet-stream
Size: 106815 bytes
Desc: not available
URL: <http://lists.andrew.cmu.edu/pipermail/alice-teachers/attachments/20190625/c1589f8b/attachment-0001.obj>
-------------- next part --------------




> On Jun 25, 2019, at 12:58 PM, Barnum, William <wbarnum at elmhurst205.org> wrote:
> 
> Here is a copy of a program that displays this issue. 
> 
> This is an example of a project that I assign students, so other student's projects that generate the error will include similar algorithms.
> 
> If I run it and play it, I can get it to terminate without error. Sometimes I have to hit the restart button several times, to get the bug to occur. Also, there are issues with the rendering of objects sometimes, which isn't really a problem but may be related.
> 
> Disabling certain methods usually causes the error to go away even if there isn't an obvious problem with the method.
> 
> Thanks,
> Bill
> <Max Video Game V14 Terminate Without Error.a3p>_______________________________________________
> alice-teachers mailing list
> alice-teachers at lists.andrew.cmu.edu
> To change settings or unsubscribe visit:
> https://lists.andrew.cmu.edu/mailman/listinfo/alice-teachers



More information about the alice-teachers mailing list