Mailing List
Home
Forum Home
MUD Dev - Discussion of MUD system design, development, and implementation
Mac Game - Mac game development
Rivers of MUD - a Diku and Merc based multiuser dungeon
SMAUG
Subjects
Getting UDP through NAT/firewalls/whatever for a game
Getting UDP through NAT/firewalls/whatever for a game
QuickTime errors
Python script as stand alone MUD server
Various sound problems
Fragment Shaders & GL TEXTURE RECTANGLE EXT
Timers and global variables
Re: Language and platform for Text MUD server
Apparent acquisition of Yantis (mysupersales) by IDE
HID keyboard
Getting UDP through NAT/firewalls/whatever for a game
Microsoft Sparkle
Director MX
Congratulations Horizons
Yet more problems fullscreen mode
Apple Dev Kitchen Them 's tasty vittles, Maw!
NSOpenGLContext, Pbuffers, and drawables
More DCR "theft " naughtiness
dynamic sprite creation and imaging lingo
Re: Find stuff in Flash array?
Effects of skill imbalances?
QuickTime errors
Rom 2 4/Quickmud Enhancement/Bug fix
Working with XML files/CFURL
smooth scrolling/subpixel tweening
RE: (Ron help me?) Flash text
Flash Racing
MudDev FAQ 2
Browser based games
Installing GLUT
Special character in Flash XML
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
smooth scrolling/subpixel tweening

smooth scrolling/subpixel tweening

2003-11-23       - By Robert Tweed

 Back
Reply:     1     2     3  

A few pointers:

1 - Don't use updateStage, ever.

2 - Don't animate in repeat loops. Use frame events instead. Use enterFrame
or stepFrame to do the majority of your processing, as these events get the
biggest CPU timeslice.

3 - To animate in fractions of pixels, simply store the position in a
property, which can have fractional values. For example, use pLoc for the
loc, then at some point do pSprite.loc = pLoc. The sprite loc will be
converted to an integer value, but internally, you will still be working
with floating point.

Wherever possible, avoid complex formulae like this:

>     pY = (-0.32 * power(abs(pX - 5), 2))  + pB

Try to stick to simple addition and subtraction as much as possible. To do a
jump, simply use values that represent force vectors. Here's an example of
some simple platformer code (needs some blanks filled in) - notice simple
the mathematical stuff is:

property pSprite, pLoc, pDir, pOnFloor
global gLeftKey, gRightKey, gJumpKey
global gGravity -- e.g., point( 0, 0.5 )

on beginSprite me
 pSprite = sprite( me.spriteNum )
 pLoc = pSprite.loc
 pDir = point( 0, 0 )
 pOnFloor = false
end

on prepareFrame me
 h = 0
 if( keyPressed( gRightKey ) ) then h = h + 4
 if( keyPressed( gLeftKey ) ) then h = h - 4
 pDir.locH = h
 if( keyPressed( gJumpKey ) ) then me.jump()
end

on jump me
 if( pOnFloor <> true ) then return
 pDir.locV = -7
end

on enterFrame me
 pOnFloor = false
 pDir = pDir + gGravity
 newLoc = pLoc + pDir
 pLoc = me.checkCollisions( newLoc )
 pSprite.loc = pLoc
end

on checkCollisions me, newLoc
 if( me.hitFloor( pLoc, newLoc ) ) then
   newLoc = me.intersectWithFloor( pLoc, newLoc )
   pDir = point( 0,0 )
   pOnFloor = true
 end if
 return newLoc
end

on hitFloor me, loc1, loc2
 -- Check to see if hit the floor
end

on intersectWithFloor me, loc1, loc2
 -- Return point where vector instersects floor
end

- Robert

__ ____ ____ ____ ____ ____ ____ ____ ____ ____
dirGames-L mailing list  -  dirGames-L@(protected)
http://nuttybar.drama.uga.edu/mailman/listinfo/dirgames-l

Earn $52 per hosting referral at Lunarpages.