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 - moving character game format

moving character game format

Discuss and publish sample code and applications written in OrbC (OrbForms Designer or PocketC Architect)

Postby marita on Mon Sep 02, 2002 1:50 am

Hi! I can't say this is a particularly advanced piece of coding, but it suits some of my purposes. If you've ever played one of those games 2-D games where your character walks around, in, and out of buildings you'll have a general idea as to what I was trying to accomplish. Right now, all there is is your little character and a big blank screen. However, if you walk to the edge of the screen, using the arrows, address, and to do buttons you can move to a new "page" as it were. You start in the upper right hand corner, so don't go that way. As you go one way and then turn another your character changes directions. The only problems I see are; how to create buildings you can go into and thereby access another function, and how to stop your little guy from blinking rather unoticeably buy very annoyingly. Still, it works and it's called Vanilla Island because it was supposed to be the foundation for a mini-game I was creating but then ran into a few snares. I also used a bitmap program to create three different main characters only one of which I've included.

//Vanilla Island
library "PToolboxLib"
#define pieN "1500000000f800018c0003760002fa0007ff0007ff000fff000fff000fff000fff800fff800fff800fff800fff800fff8007af0000f80000a80001540001fc00"
#define pieE "1500000000fc0001be00037e0002fa0006c20007ca000782000f84000fc4000ff8000fd0000fc8001fc8001ff4001ffc0007f80000f80000d80000a40000f800"
#define pieS "1500000001fc0003fe0003bf0007bf000607000651000601000e23000f07000fff800fdf800e53801d258003060001fc0000f80000f80001ac0002520003fe00"
#define pieW "1500000000fc0001f60003fa00027b00020d00028d0002070001030001070000ff80005f8000878000a78000b7c0008f0000f80000f80000d80001280000f800"
//function protos
SetUpGlobe();
GetMove();
//globals
int mx=1;
int my=17;
int gx=1;
int gy=1;
string mypie=pieS;
pointer globe;

main (){
int keepg=true;
SetUpGlobe();
graph_on();
clearg();
hookhard(1);
bitmap (mx,my,mypie);
while (keepg) {
keepg=GetMove();
}
alert (keepg);
}

SetUpGlobe(){
globe = Array("c,4,4");//20,20
}
GetMove() {
int move;
move=event(2);
switch(move) {
case 2:
alert(mx + ", " +my);
break;
case 5://North
if (my>17){
my=my-3;
}else{
if (gy>1) {
my=137;
gy--;
}}
mypie=pieN;

break;
case 6://South
if (my<137) {
my=my+3;
}else{
if (gy<4) {
my=17;
gy++;
}}
mypie=pieS;

break;
case 8://West
if (mx> 1) {
mx=mx-3;
}else {
if (gx>1) {
mx=142;
gx--;
}}
mypie=pieW;

break;
case 9://East
if (mx<142) {
mx=mx+3;
}else{
if (gx<4) {
mx=1;
gx++;
}}
mypie=pieE;

break;
}//end switch
clearg();
bitmap (mx,my,mypie);
return true;
}

good luck!

Aimee M Clay
marita
 
Posts: 21
Joined: Thu Aug 29, 2002 7:29 pm
Location: USA

Postby soinsg on Mon Sep 02, 2002 3:53 pm

Firstly I think you may have posted in the wrong forum. You posted in Development Discussion / OrbForms Designer user samples, but seeing as VI compiled in PocketC for Palm I suggest Development Discussion / PocketC on Palm OS.

I also suggest having a look at Kyle's Quest (http://www.crimsonfire.com). Last time I tried the demo, it worked by having the screen divided up into a grid with background tiles and Kyle jumping from square to sqauare. Each grid square had either a background tile or an animated Kyle in it. Maybe you already know this and want to make your own thing that is similar.

Grid squares could be labelled with jump spots, so stepping on a door would appear to take you into a room/building, but it actually transfers you to sonewhere else on the map (tiled to look like a room). You can use PTB's Array() for a multidimensional array that stores info about each grid square. You only have to redraw when the player decides to move. But if you have more ideas for sprites you can always use PTB's buffer functions.
soinsg
 
Posts: 198
Joined: Thu May 17, 2001 4:26 pm


Return to OrbC User Samples

Who is online

Users browsing this forum: No registered users and 1 guest

cron