|
Author |
Topic: newbie syntax question (Read 307 times) |
|
whiteflea
|
newbie syntax question
« on: Sep 7th, 2004, 9:13pm » |
|
toxis code: Code: public class Particle { float xpos,ypos; float xspeed,yspeed; int width, height; Particle(float x, float y, float xs, float ys, int w, int h) { xpos=x; ypos=y; xspeed=xs; yspeed=ys; width=w; height=h; } void update() { xpos+=xspeed; ypos+=yspeed; if (xpos<0) xpos+=width; else if (xpos>=width) xpos-=width; if (ypos<0) ypos+=height; else if (ypos>=height) ypos-=height; } } |
| reffering to this: http://processing.org/discourse/yabb/board_general_action_displ_ay_num_1072722668.html Question: Why is in Prticle Class x,y in float and not in int x,y coordinates are stored in int, because pixels are int. ins't it ps:im divin into oop right now. and i like the feeling! cheers whiteflea
|
================================== Software is mindcontrol - get some ================================== Shut up or I will replace you with a very small processing script
|
|
|
fjen
|
Re: newbie syntax question
« Reply #1 on: Sep 8th, 2004, 4:42pm » |
|
hmm. it totaly depends on what you wanna do with it later on ... having them stored as int would be a 1:1 representation of the coordinates on screen .. but you might wanna render them using wu-pixels (antialiased representation, like with smooth lines in processing) then you'd need somehow more precise coordiantes .. of course that's just a guess, i'm sure toxi knows best. wupixels: http://freespace.virgin.net/hugo.elias/graphics/x_wupixl.htm
|
« Last Edit: Sep 8th, 2004, 4:43pm by fjen » |
|
|
|
|
|