Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • B bjgf
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Issues 127
    • Issues 127
    • List
    • Boards
    • Service Desk
    • Milestones
  • Jira
    • Jira
  • Packages and registries
    • Packages and registries
    • Model experiments
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar
  • BlueJ
  • bjgf
  • Issues
  • #1538

[GREENFOOT-194] Needing JavaScript-Controlable Greenfoot-Viewer-Applet

Hello,

it would be nice to be able to control Greenfoot with JavaScript. I think there is only one method to implement for this that returns the world like the following:

{noformat} public World getWorld() {return world;} {noformat}

Then I can go on with the public methods of the world. There should be added:

{noformat} public Object doEval(String cmd) { return eval(cmd); } {noformat}

I would like to use it in a JScript that has wrapper functions like the following:

{noformat} function createObject(objectid, x, y) { var world=document.greenfootApplet.getWorld(); if (objectid == 1) { world.doEval("addObject(new Wombat(), x, y)"); } else if (objectid == 2) { world.doEval("addObject(new Bird(), x, y)"); } } {noformat}

... and others for uploading and downloading "levels" for an greenfoot-based game.


Issue metadata

  • Issue type: Task
  • Priority: Medium
  • Fix versions: 2.0
Assignee
Assign to
Time tracking