Public boolean onWall() // test to see if the man class is on the wall classĪctor Wall = getOneObjectAtOffset( 0, 0, Wall.class) Īctor Door = getOneObjectAtOffset( 0, 0, Door. Greenfoot offers the ability to record your own sounds within the IDE. SetLocation(getX(),getY()+1) // move downĪctor Fire = getOneObjectAtOffset( 0, 0, Fire.class) SetLocation(getX()+1,getY()) // move Right SetLocation(getX()-1,getY()) // get loaction of x and y, then move -1 on x move Left I tried with another tutorial but the music keeps looping. I have the sound i want to add and I have a getWorld, Player, Weapon, Projectile, etc players but I dont know how to add the music. But I dont know how to add background music. The catch is that in your case you have to know about the collision before the collision happens. Im confused, I setup a whole zombie game through a tutorial. Share 3.5K views 6 years ago Greenfoot tutorials Triggering a sound on an event, in this case a collision.more. isTouching(Tree.class) checks whether the actor collided with a tree. * the 'Act' or 'Run' button gets pressed in the environment.ĬheckKeyPress() // call this method to work zip, 29.6 MB This is a full saving and making sounds lesson, via Greenfoot, is an easy to understand lesson with full teaching code, and completely editable. Greenfoot already provides methods to check whether a collision happened, e.g. This means that there is basically only exactly one instance of Settings. In fact, due to it being abstract in the way I wrote above, you actually cant create an object from it. Import greenfoot.* // (World, Actor, GreenfootImage, Greenfoot and MouseInfo) Settings does not have to extend Actor as it has not got to be added to the world. Is there a way to add a sound based on an object class that you land on? and that it will only play every 5 seconds ? so far I got it to play when I'm on the object but it plays so fast.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |