This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

-ck3-
-ck3- presents ...

2014/6/22

Dog Days of Summer

Fido starts out his adventure asleep...like most dogs with nothing to do. After a brief snooze, he's charged and full of energy. After moving 30 steps, Fido will lose a little energy (-1). When Fido reaches 70% energy, he will move slower.
* when Fido reaches 0 energy, he will fall back to sleep and regain his energy. When Fido finds his ball, he will dance and lose 50 energy.
* I'm interested in finding out how to prevent placement or movement off the floor. Like setting some kind of an invisible wall to prevent the Actors from being placed above that spot.

Background Copyright: Simmons, C. Dodo Kitchen April 18, 2013

2342 views / 15 in the last 7 days

Tags: simulation with-source

open in greenfoot
Your browser is ignoring the <APPLET> tag.
lordhersheylordhershey

2014/6/23

You can define an actor to that he must be in contact with it to be there, or the invisible wall will work as well. you can go either way. In the dragonfire scenario I use invisible barriers on the bridge just over the entrances and in the treasure room.
danpostdanpost

2014/6/23

After the move or setLocation command, compare the returned value of getY to the lower y limit (somewhere around 420, I am guessing; I will call it 'minimumY'). If the value returned is less than the minimum, set the location back to (getX(), minimumY).
-ck3--ck3-

2014/6/24

Thanks guys.

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.