Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - movement
Page 1 of 1

PostPosted: Tue Dec 02, 2003 10:18 pm
by torchicfirepants
I need help with movement.
i am a beginner and can use just about every function
and command. but, i still have a hard time with movement.
i've also looked at the graphics and sprite expamles. please help

-kyle

PostPosted: Mon Dec 08, 2003 11:05 pm
by jstadolnik
This is really not a PToolboxLib question, but rather a basic question about how to do movement.

Here is an example (it doesn't even use the PToolboxLib).

Joe

----------

//move.pc
main() {
int e, x_pos=80, y_pos=80, x_move, y_move;
hookhard(1);
graph_on();

//draw object
rect(1,x_pos,y_pos,x_pos+10,y_pos+10,0);

while(1) {
e=event(1);
switch(e) {
case 5: y_move=-1; break; //up
case 6: y_move=1; break; //down
case 7: case 8: case 16: x_move=-1; break; //left
case 9: case 10: case 17: x_move=1; break; //right
}

//erase object
rect(0,x_pos,y_pos,x_pos+10,y_pos+10,0);

//calculate new position
x_pos = x_pos + x_move;
y_pos = y_pos + y_move;

//draw object in new position
rect(1,x_pos,y_pos,x_pos+10,y_pos+10,0);

//zero out movement variables
x_move=y_move=0;
}
}

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm

PostPosted: Fri Dec 12, 2003 11:07 pm
by torchicfirepants
<font face="Comic Sans MS">Thanks, it works perfectly!
now, i need to figure out how to erase bitmaps with resource ids.
ive tried drawing a white bitmap in the spot of the object, but that would cause problems at certain times.[:p]</font id="Comic Sans MS">

-kyle

PostPosted: Sat Dec 13, 2003 12:01 am
by jstadolnik
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
now, i need to figure out how to erase bitmaps with resource ids.
ive tried drawing a white bitmap in the spot of the object, but that would cause problems at certain times.
<hr height="1" noshade id="quote"></blockquote id="quote"></font id="quote">

See the single and double buffer examples in graphics.c file of the PToolbox kit. They essentially erase the entire screen then redraw all the bitmaps for each frame.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm

PostPosted: Sat Dec 13, 2003 5:06 pm
by torchicfirepants
thanks.

-kyle

PostPosted: Wed Dec 17, 2003 6:40 pm
by torchicfirepants
i've tried double, triple, and even quadruple buffering, and the screen flashed every time i got the object to move

-kyle

PostPosted: Wed Dec 17, 2003 7:01 pm
by jstadolnik
Show your code.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm

PostPosted: Thu Dec 18, 2003 10:57 pm
by torchicfirepants
//squez
library "PToolboxLib"
#include "Fctl.h"

#define FORM1 3000
#define FORM2 3001
#define BUTTON1 3002
#define BUTTON2 3003
#define BUTTON3 3004
#define BUTTON4 3005
main () {
int e;
int xm;
int xp;
int ym;
int yp;
int xm2;
int xp2;
int ym2;
int ym2;
int xm3;
int xp3;
int ym3;
int yp3;
int xm4;
int ym4;
int xp4;
int yp4;

xp=60;
yp=130;

OpenBmpDb("Squ");
puts("is loading,sonofabish!!!\n loading...");
hookhard(2);
sleep(5000);

Form(FORM1,"T1L0");

Form(FORM2,"T1L0");
Button(BUTTON1,1,130,40,15,15,"^");
Fctl(DRAW,FORM2);
//you.bmp
bitmap(80, 80, "10000003c0042008100810042003c0038005600910010001000100028004800840");
FastBmp(0,20,2);
FastBmp(xp,yp,4);
while(1) {
e=Fevent(1);
switch(e) {
case 5:
ym=-5;
FastBmp(xp,yp,4);
break;
case 6:
ym=5;
break;
FastBmp(xp,yp,4);
break;
case 2:
xm=5;
break;
case 1:
xm=-5;
break;
}
FastBmp(xp,yp,4);
xp=xp+xm;
yp=yp+ym;
SetDrawBuf(0);
SetDrawBuf(0);
ClearBuf();
SetDrawBuf(0);
SetDrawBuf(0);

FastBmp(xp,yp,4);
FastBmp(xp,yp,4);
FastBmp(xp,yp,4);
FastBmp(xp,yp,4);
FastBmp(0,20,2);
FastBmp(0,20,2);

}
xm=ym=0;
}






-kyle

PostPosted: Fri Dec 19, 2003 12:38 am
by jstadolnik
Well, you have two serious problems.

1) You are only calling SetDrawBuf(0), where 0 is the screen itself. By default the current buffer is already 0. So you're not actually using any buffers.

2) You never call CopyBuf() to copy a buffer to the the screen.

So basically, all the SetDrawBuf() calls you are making are having no effect and you code keeps erasing and re-drawing the current screen... thus all the flicker.

Take a hard look at the graphics.c example. I would suggest walking through it line-by-line and not to progress further until you understand what a given line is doing. Ignore the "old sprite technique" and stick to understanding the double & triple buffering techniques. Also, try replacing the FastBmp() with bitmap() calls in graphics.c, this may makes things a little simpler.

Joe

The PToolboxLib guy.
http://www.geocities.com/retro_01775/PToolboxLib.htm