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

2021/5/24

How do I declare the value of a variable as i create an actor

MrMinestrone MrMinestrone

2021/5/24

#
f f = new f();
        f.pstart = 10;
        addObject(f,403,191);
Here's my code, can I declare the variable pstart as I create the object f.
Yusj Yusj

2021/5/24

#
You need declare the value in the bracket.
MrMinestrone MrMinestrone

2021/5/24

#
which brackets, the ones in the first or third line, also I declared the variable in the actor if that's what u mean
Yusj Yusj

2021/5/24

#
yep ,if u wanna declare the value of pstart ,its correct.
You need to login to post a reply.