How to move a object

edited April 2018 in How To...

How to move a object with a key stroke?

Answers

  • Cool, what's your question?

  • How to code it

  • Answer ✓

    This is not how the forum works.

    this is for a class project

    nobody will do your homework for you. You tried that on your last discussion already.

    break your task down into steps and show your attempt, your code and then ask a concrete question

    This is how the forum works.

  • edited April 2018

    Okay. What code do you have so far? Post your code.

    If you don't have any code, attempt to write some. Then post your attempt.

    If you've read the description, you know you will need two classes, one for your Ship object and one for the Iceberg objects.

    Your sketch should probably also have one setup() and one draw() function.

    That alone is enough for you to write some code. So try to do so now.

  • there are tons of examples, code in the reference

    especially read the tutorial objects - see tutorial section

  • edited April 2018

    don't delete or alter you original post please

    it makes the discussion incomprehensible

    instead just answer below

    when an object has a position x,y and a key is pressed, say x++;

    look at reference keyPressed and key

  • it makes the discussion incomprehensible

  • How do I delete a delete a question?

  • you don't, it's against the forum rules

  • Oh ok thanks

  • good luck with your code!

    Best, Chrisir ;-)

  • how far are you?

  • https://forum.processing.org/two/discussion/27769/how-to-move-with-a-key-stroke

    original post was vandalised...

    "You are the captain of the S.S. Ship, which is on its maiden voyage from Europe to America. Your mission is to safely navigate the ship without hitting any “icebergs”. This program will be utilizing objects/classes for both a boat and an array of icebergs.

    Object one is the ship, which moves horizontally across the sketch;

    Object two: is an array of icebergs. The speed and location does vary.

    If the ship successfully crosses the sketch to the other side (America), then you win.

    If the two objects “intersect”, ship and any one of the icebergs, then the ship “sinks” and you lose L

    Your sketch should be enhanced graphically to reflect this game.

    Output should be formatted so that it is easy-read."

    and is obviously course work.

This discussion has been closed.