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

2017/6/11

i want re use the button up,left,right,down for next level please help me

dadansi dadansi

2017/6/11

#
i want know kode for use again the button in my scenario. help me masterrr
Yehuda Yehuda

2017/6/12

#
I don't understand what you want. The buttons on the keyboard can be used for whatever you code them to do in the place that you put the code.
dadansi dadansi

2017/6/12

#
not button the keyboard, but i make the button with method mousePressed. please help me. you can see my project please master
Yehuda Yehuda

2017/6/12

#
dadansi wrote...
not button the keyboard, but i make the button with method mousePressed.
That's even worse. You can't use mousePressed for the keyboard. That method is for mouse presses, they weren't mentioned before.
danpost danpost

2017/6/12

#
Without looking at your scenario, I think you could have something like this in your world class:
// with instance fields
Actor right, down, left, up;

// and constructor
right = new Arrow();
addObject(right, midX+50, midY);
down = new Arrow();
down.turn(90);
addObject(down, midX, midY+50);
left = new Arrow();
left.turn(180);
addObject(left, midX-50, midY);
p = new Arrow();
up.turn(270);
addObject(up, midX, midY-50);

// you can have act
if (Greenfoot.mousePressed(right)) doA();
if (Greenfoot.mousePressed(down) doB();
if (Greenfoot.mousePressed(left)) doC();
if (Greenfoot.mousePressed(up) doD();
'midX' and 'midY' are the central coordinates of where you place the arrows in your world.
dadansi dadansi

2017/6/13

#
i don't understand mr.danspot.. i think i can't do it. please see my scenarion master. :) help me
dadansi dadansi

2017/6/13

#
Yehuda.. yes i make that code for mouse.. you can see my project please help me
Yehuda Yehuda

2017/6/13

#
What are you actually trying to do and in which scenario?
dadansi dadansi

2017/6/14

#
in all my scenario. you can hep me. in my scenario i have button for mouse pressed
Yehuda Yehuda

2017/6/14

#
So if that's what you want to do then do it. danpost's code should be in the World that you want to host these arrows.
You need to login to post a reply.