Array Help

Talk about making games.

Array Help

Postby willg101 » Tue Nov 29, 2005 1:50 am

I just now discovered somwhat how arrays work. Can someone tell me what's wrong with this code?
Code: Select all
xm1=&xmouse+120;
xm2=xmouse+120;
ym1=&ymouse+160;
ym2=ymouse+160;
if(draw == 1)
{
  screen_to_actor(&xmouse, &ymouse);
  xmouse1[xm1]=1;
  xmouse2[xm2]=1;
  ymouse1[ym1]=1;
  ymouse2[ym2]=1;
  lineto(xmouse, ymouse);

}

This is part of my "save canvas" code. The xmouse arrays are 240 and the ymouse arrays are 320.

Image
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby Joshua Worth » Tue Nov 29, 2005 6:29 am

Funny, I had that same problem just a couple of days ago
Stay sweet
User avatar
Joshua Worth
 
Posts: 515
Joined: Tue Jul 19, 2005 12:00 am
Location: Stralia
Score: 5 Give a positive score

Postby makslane » Tue Nov 29, 2005 1:39 pm

Code: Select all
xm1=&xmouse+120;


&xmouse its the address of xmouse variable.
Doesn't make sense to use here.
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby willg101 » Tue Nov 29, 2005 9:29 pm

Hmm...
I can't say I was think logically when I wrote this, I was just trying to save all the info so I could reload it later on. How should I go about doing this?
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby makslane » Wed Nov 30, 2005 1:07 am

What you need to save?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby willg101 » Wed Nov 30, 2005 1:59 am

I am trying to save/reload a canvas.

Actually, now I have the save code down:
Code: Select all
ym0=ymouse;
xm0=xmouse;
if(draw==1)screen_to_actor(&xmouse, &ymouse);
if(draw==1)lineto(xmouse, ymouse);
if(draw==1)xm[xm0]=1;
if(draw==1)ym[ym0]=1;

(I know I could've done the conditional action part better. I just forgot how when I wrote this code.)

If anyone has a better idea of how to save a canvas, please tell me, but I think I've got it now...

Thank you very much!
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score

Postby makslane » Wed Nov 30, 2005 12:35 pm

Are working?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby willg101 » Thu Dec 01, 2005 2:22 am

I think the save part is working.
http://www.wish-games.com
Old betas now available!!
User avatar
willg101
 
Posts: 473
Joined: Thu Dec 16, 2004 12:08 am
Location: West Michigan
Score: 5 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron