NXC on windows and mac
Posted: 12 Mar 2011, 22:53
Hello. I am making a game. It uses a ric file and the following NXC code. When I compile it in BricxCC I get a different result that if I compile it on a mac using the applescript application John Hansen made. Can someone please explain to me why I get different results.
and happy birthday to jojoguy14 and matelle37
Code: Select all
#define speedX 5
#define speedY 5
int screen[5];
int jumpstate;
bool onground;
task moveX(){ //Handles X axis of movement
while(true){
if(ButtonPressed(BTNLEFT, false)){
if(screen[3]<=0){
screen[3]=0;
if(screen[0]<=7){
screen[0]=5;
}else{
screen[0]-=speedX;
}
} else if(screen[3]>=212 && screen[0]>48){
screen[0]-=speedX;
} else{
screen[3]-=speedX;
}
} else if(ButtonPressed(BTNRIGHT, false)){
if(screen[3]>=212){
screen[3]=212;
if(screen[0]>=88){
screen[0]=88;
} else{
screen[0]+=speedX;
}
} else if(screen[3]<=0 && screen[0]<48){
screen[0]+=speedX;
} else{
screen[3]+=speedX;
}
}
Wait(0146);
}
}
task moveY(){ //Handles Y axis of movement
SetSensorTouch(S1);
onground=true;
while(true){
if(onground){
if(ButtonPressed(BTNCENTER, false)){
if(screen[4]>=55 | screen[4]<=0){
if(screen[1]>=20 && !screen[4]>=55){
if(jumpstate<2){
screen[4]+=speedY;
} else{
screen[4]-=speedY;
}
if(jumpstate<3){
jumpstate+=1;
} else{
jumpstate=0;
}
} else{
if(jumpstate<2){
screen[1]+=speedY;
} else{
screen[1]-=speedY;
}
if(jumpstate<3){
jumpstate+=1;
} else{
jumpstate=0;
}
}
} else{
if(jumpstate<2){
screen[4]+=speedY;
} else{
screen[4]-=speedY;
}
if(jumpstate<3){
jumpstate+=1;
} else{
jumpstate=0;
}
}
} else if(Sensor(S1)==1){
if(screen[4]>=55){
screen[4]-=speedY;
} else{
screen[1]-=speedY;
}
} else{
jumpstate=0;
}
} else{
if(screen[4]>60){
screen[4]-=speedY;
} else{
screen[1]-=speedY;
}
}
Wait(0146);
}
}
task print_graphics(){
while(true){
GraphicOutEx(0,0, "smilo_maps.ric",screen);
Wait(0146);
}
}
task main(){
//Default Stuff When Game Is Started
screen[0]=5; //Smilo Location X
screen[1]=5; //Smilo Location Y
screen[2]=3; //screen Sprite Id(2=Empty map, 3=Level 1)
screen[3]=0; //screen Scroll X (0-312)
screen[4]=0; //screen Scroll Y (0-120)
Precedes(moveX,moveY,print_graphics);
}
//(X:)62 units by (Y:)24 units
//1488 Squares (62.24)