Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Language Question

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 10th Sep 2014 14:58 Edited at: 10th Sep 2014 15:18
Hi.

I want create 5 sprite with for loop in x position. I wrote this code but don't work.

Please Guide Me.



Thanks
Marl
12
Years of Service
User Offline
Joined: 19th Nov 2011
Location: Bradford, UK
Posted: 10th Sep 2014 16:09
1) Your initial value for cspr is 0, but this is not a valid number for a sprite.
2) you are not changing the value of cspr in the loop so each time it is checking the same value
3) you are not changing the position of the cloned sprite
You need either;
- use a different value for cspr, then change this in the loop
- Add the loop index (x) to cspr to get a different value;
if getspriteexists (cspr + x ) = 0 then CloneSprite (cspr + x , spr)

Personally, I would use the loop index as the sprite value and position offset;
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 11th Sep 2014 21:19 Edited at: 11th Sep 2014 21:34
Thanks Marl.

I want make 4 x 4 sprite and want can access to each sprite seperated for change image. how can make it?

NOTE: I want make a match up game. I need idea for make it.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 12th Sep 2014 10:17 Edited at: 12th Sep 2014 10:33
for make a Match game I should Create 16 sprite?

the Largest my Problem for make game is working with Sprites. Please Learn me how can work with Sprites with Array and loop.

Thanks.
fog
20
Years of Service
User Offline
Joined: 5th Oct 2003
Location: Newcastle, England
Posted: 12th Sep 2014 15:50
Nobody is going to just teach you those things. You need to try for yourself and then ask questions and post code when you have a problem.

Try this match-3 code that Mark Harrison kindly posted to get started.

http://forum.thegamecreators.com/?m=forum_view&t=212032&b=48&p=0#m2533505

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 12th Sep 2014 20:06
I made 4 sprite with for loop.bu i don't know how can access to seperated sprite.for example I want change image for sprite 1, or change color and ...

please guide me.

janbo
15
Years of Service
User Offline
Joined: 10th Nov 2008
Location: Germany
Posted: 13th Sep 2014 00:31 Edited at: 13th Sep 2014 00:39
You just create an Array with the required size(4)
Try:


knowing arrays and how they work is fundamental for programming.

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 13th Sep 2014 09:02
thanks janbo.

I'm newbie Programmer. I know array syntax but had never used the array.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 14th Sep 2014 11:43
how can create 16 sprite (4 x 4) with one for loop?
JimHawkins
14
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 14th Sep 2014 20:44
Learn about n-dimensional arrays.

-- Jim - When is there going to be a release?

Login to post a reply

Server time is: 2024-04-20 00:34:06
Your offset time is: 2024-04-20 00:34:06