Help Programming

mat88

Well-Known Member
OP
Member
Joined
Jun 21, 2003
Messages
169
Trophies
0
Age
36
Location
Montreal
Website
Visit site
XP
216
Country
Canada
Hi,
I'm trying to program the scrolling of a background (NDS) and it's working. The only problem is, when I continu to press on the left et we are at the limit, the background stop (ok) but the value of scrolling continu to decrease (not ok). I tryed put a condition if to bloc the value to zero but it didn't work.

there is a part of the code
hate2.gif

CODEÂÂÂÂscrollx += (Pad.Held.Right - Pad.Held.Left);
ÂÂÂÂscrolly += (Pad.Held.Down - Pad.Held.Up);
ÂÂÂÂif(scrollx
 

CockroachMan

Scribbling around GBATemp's kitchen.
Member
Joined
Jan 14, 2006
Messages
3,887
Trophies
0
Age
38
Location
Brazil
Website
www.homembarata.com.br
XP
707
Country
Brazil
How do you know that the values are decreasing? Are you using something to print the values for you?

Anyway.. are you using unsigned variables? That can lead to overflow and keep your variables always positive..
 

mat88

Well-Known Member
OP
Member
Joined
Jun 21, 2003
Messages
169
Trophies
0
Age
36
Location
Montreal
Website
Visit site
XP
216
Country
Canada
I use u32 scrolly, scrollx
Yes I have a debug function that print it.

Code:
ÂÂÂÂPA_InitText(0,2);
ÂÂÂÂPA_OutputText(0,1,6,"Position: (x=%d;y=%d)",scrollx,scrolly);

Between I use PAlib to code on DS
 

mat88

Well-Known Member
OP
Member
Joined
Jun 21, 2003
Messages
169
Trophies
0
Age
36
Location
Montreal
Website
Visit site
XP
216
Country
Canada
I have an other problem
shy.gif

I need help with a table of string
CODE#include or? #include
int main(int argc, char ** argv)
{
string city[10]={"Ville départ","Port1"}; or? std::string city[10]={"Ville départ","Port1"};
}
I'm using Devkitpro whit PAlib (using the build.exe)
 

CockroachMan

Scribbling around GBATemp's kitchen.
Member
Joined
Jan 14, 2006
Messages
3,887
Trophies
0
Age
38
Location
Brazil
Website
www.homembarata.com.br
XP
707
Country
Brazil
You can use

CODE#include
using namespace std;
int main(int argc, char ** argv)
{
string city[10]={"Ville départ","Port1"};
}

or

CODE#include
int main(int argc, char ** argv)
{
std::string city[10]={"Ville départ","Port1"};
}

same result..
 

Mangofett

GBAtemp Testing Area
Member
Joined
May 14, 2006
Messages
4,885
Trophies
1
Age
19
XP
1,059
Country
United States
And while we're on discussion of PAlib, how would I go about assigning array values to sprites? like if I have something like arrayx[10] and araayy[7], and I have an actual grid with sprites on screen.
 

mat88

Well-Known Member
OP
Member
Joined
Jun 21, 2003
Messages
169
Trophies
0
Age
36
Location
Montreal
Website
Visit site
XP
216
Country
Canada
thank you, it's working now!

but my next problem is coming.
Is it possible to have 2 PA_InitText? (in different function)

like
Code:
function1()
{PA_InitText(0,2);}
function2()
{PA_InitText(1,2);}

int main()
{
while(1)
{
function1();
function2();
}
}
 

Site & Scene News

Popular threads in this forum

eof

General chit-chat
Help Users
    Xdqwerty @ Xdqwerty: @K3Nv2, and sticky