var bob={
bab:'jim'
};
var jim=createSprite(200,200);
function movejim(plart) {
plart.x=plart.x+5;
console.log(plart);
}
function draw() {
movejim(bob.bab);
drawSprites();
}
The console log display that bob.bab is equal to jim but jim will not move, is there a way to achieve something similar to what im trying to do?
This is on code.org by the way since thats why my teacher wants me to use, here is a link to it Game Lab - Code.org
I am not sure I understand — do you want to move the variable jim? The one defined as var jim = createSprite(200, 200)?
That’s not the same thing as the string "jim".
If you want to have the sprite inside the object you need to add it inside the object, something like bob.bab = createSprite(200, 200)
My goal here is to move jim using a function and a subsection so if i ever needed a different sprite to move insted of jim, like for example if i had var barry=createSprite(200,200), I would be able to do bob.bab=“berry” and my function would still work.