Sokkiejjj

Online

Joined: May 20, 06

Home page Email

Naruto Ultimate Revised Owner

Wanna contact me?

E-mail/Google Talk:
dijkertje@gmail.com


AIM:
rickdasok


Yahoo:
rick.vandijk@yahoo.com


MSN:
rick.van.dijk@hotmail.com

My libraries

 

 

Pixel movement, easy?

I always thought Pixel Movement was some hard ass coding. But I think I figured it out, because it works perfectly at me.

I'm not a expert at this kind of coding, and yes, you guys will probably will find flaws, and I will already apologize for the shitty code because I know you guys would've done it on a other way.

But here is it anyway:
client
    North(){usr.pixel_y++;if(usr.pixel_y>=64){usr.y+=2;usr.pixel_y=0}}
    South(){usr.pixel_y--;if(usr.pixel_y<=-64){usr.y-=2;usr.pixel_y=0}}
    West(){usr.pixel_x--;if(usr.pixel_x<=-64){usr.x-=2;usr.pixel_x=0}}
    East(){usr.pixel_x++;if(usr.pixel_x>=64){usr.x+=2;usr.pixel_x=0}}
    Northeast(){usr.pixel_y++;if(usr.pixel_y>=64){usr.pixel_y=0;usr.y+=2};usr.pixel_x++;if(usr.pixel_x>=64){usr.x+=2;usr.pixel_x=0}}
    Northwest(){usr.pixel_y++;if(usr.pixel_y>=64){usr.pixel_y=0;usr.y+=2};usr.pixel_x--;if(usr.pixel_x<=-64){usr.x-=2;usr.pixel_x=0}}
    Southeast(){usr.pixel_y--;if(usr.pixel_y<=-64){usr.y-=2;usr.pixel_y=0};usr.pixel_x++;if(usr.pixel_x>=64){usr.x+=2;usr.pixel_x=0}}
    Southwest(){usr.pixel_y--;if(usr.pixel_y<=-64){usr.y-=2;usr.pixel_y=0};usr.pixel_x--;if(usr.pixel_x<=-64){usr.x-=2;usr.pixel_x=0}}


I was also figuring why 64 pixels and 2 locs would work, but why 32 pixels and 1 loc change wouldn't work correctly, but I couldn't find that out, so I sticked to 64 and 2.

Well yeah,

It's probably shit, but I think it's worth it.

Regards,

Rick

Posted by Sokkiejjj on Monday, July 28, 2008 08:35AM - 4 comments / Members say: yea +0, nay -0

« Perfect screen sizes D: · Soon to get a sexy gaming rig »

Login to post a comment.

#4 Jeff8500:  

Pixel movement in and of itself is simple. However, when you get into collision detection, it gets more complicated. And when you get into using trig, it can get really complicated, at least from the perspective of someone who won't be taking trig for another two years.

Tuesday, August 05, 2008 11:40AM

#3 Lyndonarmitage1:  

Looks alright, I wonder why 32 and 1 doesn't work though.

Tuesday, July 29, 2008 03:05PM

#2 Sokkiejjj:  

Lol.

Tuesday, July 29, 2008 08:37AM

#1 Kazekage The 3rd:  

Yees it is

Tuesday, July 29, 2008 08:37AM