How to access variables without changing them

I have a variable, player.accel(0.2). I want to be able to access the variable, bullet.accel(player.accel()+70) but as you know that doesn't work. Got tips for the code?

Answers

  • edited October 2016 Answer ✓

    In player.accel(0.2);, player is a variable, while accel() is a method.
    You're already accessing method accel(), but to execute an action. :-B
    Take a look at the access operator .: https://Processing.org/reference/dot.html

  • Answer ✓

    but as you know that doesn't work

    No I don't know.

    If I assume that the acceleration value is being stored as a float and the accel() method is used to get its value and accel(float) is used to set its value then there is nothing wrong with the statement bullet.accel(player.accel()+70)

    To help further we need to see source code for the two accel methods code or the class code that contains this method.

Sign In or Register to comment.