Slick Forums

Discuss the Slick 2D Library
It is currently Thu May 23, 2013 11:30 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Vector2f help
PostPosted: Wed Jul 04, 2012 1:27 am 
Offline

Joined: Wed Jan 25, 2012 11:37 pm
Posts: 11
I apologize in advance I am a noob.

Ok, so I get a null pointer exception whenever I try to use the set() function.
Code:
// the x and y are floats
      position.set(x,y);

So the only way I can set the value of a vector2f is making a whole new vector2f and then setting its value to the original.
Code:
// the x and y are floats
      position = new Vector2f(x,y);

What am I doing wrong?


Top
 Profile  
 
 Post subject: Re: Vector2f help
PostPosted: Wed Jul 04, 2012 1:33 am 
Offline
Regular

Joined: Tue Aug 23, 2011 8:19 am
Posts: 111
Did you initialize the variable 'position' before trying to set its x and y? Look at the last post from me here if you don't know what I'm talking about.

_________________
My indie games: http://cmagames.webs.com


Top
 Profile  
 
 Post subject: Re: Vector2f help
PostPosted: Wed Jul 04, 2012 1:56 am 
Offline

Joined: Wed Jan 25, 2012 11:37 pm
Posts: 11
cmasupra wrote:
Did you initialize the variable 'position' before trying to set its x and y? Look at the last post from me here if you don't know what I'm talking about.

Wow, how am i this absent-minded?
Yeah that was the problem, Thank you so much! :D


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group