I have an infinite room wrapping code (integrated into all the objects in this concept game I'm putting together). Everything looks great, it runs smoothly and wraps objects and drawing perfectly. Except for one strange problem. My main character stutters for one frame when he passes over the "wrap line." This is very strange, because it doesn't happen with all the other moving objects that go across this line (such as moving dust balls).
First off, here is the executable for a simple test level. Controls are W for jump and A/D for moving. When you pass underneath the big arrow, you'll notice a slight glitch in the sprite.
http://www.box.net/shared/5qixobbimt
I have a feeling it's something to do with the view-following code in the main object's step event, but I'm not sure.
Here's some stats for the view:
height=240
width=144
wport=768
hport=432
// STEP EVENT
// left and right just check if the keys are being pressed
// this first section just scales the view, probably doesn't effect this problem
if left or right or y!=yprevious
{
moving=min(moving+0.5,5)
}
if !right and !left and y=yprevious
{
moving=max(moving-0.5,0)
}
if moving>=0
{
view_wview=wview*(1+moving/15)
view_hview=hview*(1+moving/15)
}
//this part actually makes the view follow the player, and wraps the player as well
var xx,yy;
realspeed=point_distance(x,y,xprevious,yprevious)
dir=point_direction(x,y,xprevious,yprevious)
xx=x-lengthdir_x(realspeed*3,dir)
yy=y-lengthdir_y(realspeed*3,dir)
view_xview=xx+sprite_width/2-view_wview/2
view_yview=yy+sprite_height/2-view_hview/2
if x>room_width
{
x=0
}
else if x+sprite_width<0
{
x=room_width-sprite_width
}



Find content
Male



