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

2014/10/17

How do i use this?

shadowfire_ew shadowfire_ew

2014/10/17

#
I have experience in c and khan academy js, but i am unfamiliar with all the commands here. how do i use the actors? I am a newbie
Alwin_Gerrits Alwin_Gerrits

2014/10/18

#
You can create actors by right-clicking actor then making a subclass. When you do you also get the option to name it straight away and pick an image for it. Looking a bit further you can see you also have a 'World' class on the right. If you make a subclass of 'World' you can use the command super(x, y, a). Now I made it with these variables on purpose because the super command used like this will determine the size of the world you're gonna be using. variable x is the width of the world, variable y is the height of the world and a is the size of one pixel within your world. I would recommend keeping variable a (pixelsize) to a value of 1 just because it's gonna be useful to have a big amount of pixels while programming later on. Within the subclass of world (which again you name yourself) you can use the command addObject(new object, x, y). If you make a subclass of actor like mentioned before it will be a usable object. So lets say you made a subclass of actor called 'player'. You can then use addObject(new player(), x, y). Obviously filling in the variables x and y should not be forgotten! Does this answer your question for now?
You need to login to post a reply.