hi erico, i tried with mp3, ogg and wav
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts MenuQuote from: Snoopy on 2013-Jul-30Quote from: tatakamucher on 2013-Jul-30
my first code uses # and dont work, int neither, i think about the ocean solution u_u
then this is not only a problem of data types (integer or float) but also a problem in your code.
Here a simple tweening movement (for clarity, the code is not optimized ) :
GLOBAL npos = 4, n1 = 0, n2 = 0, dtime, x_rect, y_rect, speed_rect, dx_rect, dy_rect, speed, distx, disty, dist, pos[]
DIMDATA pos[], 10, 10, 200, 10, 250, 200, 10, 200 // X, Y Format
x_rect = pos[0]
y_rect = pos[1]
speed_rect = 2
WHILE TRUE
IF dist <= 0
n2 = n1 + 1
IF n2 >= npos THEN n2 = 0
distx = pos[n2 * 2 + 0] - pos[n1 * 2 + 0] // X
disty = pos[n2 * 2 + 1] - pos[n1 * 2 + 1] // Y
dist = SQR((distx * distx) + (disty * disty)) // Distance
dx_rect = distx / dist
dy_rect = disty / dist
INC n1
IF n1 >= npos THEN n1 = 0
ELSE
DEC dist, speed_rect * speed
ENDIF
INC x_rect, dx_rect * speed_rect * speed
INC y_rect, dy_rect * speed_rect * speed
//DRAWRECT INTEGER(x_rect), INTEGER(y_rect), 50, 50, RGB(244,0,0)
DRAWRECT x_rect, y_rect, 50, 50, RGB(244,0,0) // For a "clean code" use INTEGER function, but GLB also accepts floating value in 2D ;)
SHOWSCREEN
speed = 30.0 * GETTIMER() * 0.001
WEND
WHILE TRUE
IF t3 = 0
t4 = GETTIMERALL()
t3 = 1
ENDIF
t2 = GETTIMERALL()- t4
IF t2 > 999 THEN t3 = 0
IF t2 < 478
x% = -24.833333
y% = 81.923077
a% = 0
t% = 0
s% = 0
a2x% = -25.5
a2y% = 79.589744
a2a% = 0
a2t% = 477
a2s% = 0
ENDIF
IF t2 > 477
x% = -25.5
y% = 79.589744
a% = 0
t% = 477
s% = 0
a2x% = -24.833333
a2y% = 81.923077
a2a% = 0
a2t% = 999
a2s% = 0
ENDIF
a3x% = x%+((a2x% - (x%))*((t2-t%)/(a2t%-t%)))
a3y% = y%+((a2y% - (y%))*((t2-t%)/(a2t%-t%)))
DRAWRECT -a3x%,a3y%,50,50,RGB(244,0,0)
SHOWSCREEN
WEND
Quote from: Kitty Hello on 2013-Jun-17
scrolling is bit slow. use two fingers to scroll, maybe?