Latest Uploads
Extraterre ... .0.1 (zip)

dantheman363

Monty Teas ... Screenie 1

steve_ancell

Santa Clau ... ed his bag

waroffice

manic_platdude.png

spinal

Tetris Clone

steve_ancell

Super blues bros.

spinal

Forum Home

Fruit Machine game

UserMessage
Posted : Monday, 10 March 2008, 11:58 | Permalink | Mark Here
spanner


Hi all,i am new to making games on the ds so i need some help..

I making a fruit machine game for the DS with Palib and I have got the reels turning....BUT....

1.To be able to start them turning with the start button on the image and button A on the DS..(Edit Codes been edited..Got it working with the A button but not the start buton on the image.)

2.How do you get the reels ainimation to stop once you pressed the A button with PA_SpriteAnimPause..

3.To make them turn randomly so they don't land on the same fruit..

4.Any help with this is welcome..

I put up the source code for you all the have a look and play with it..


Picture..

Highslide JS

-->



-----
Span
Posted : Monday, 10 March 2008, 13:01 | Permalink | Mark Here
spanner


I was trying that to get the A button to make the reels turn..can you help..?

Got it working with the A button but not the start button on the image.

Anyone..?


-----
Span
Posted : Monday, 10 March 2008, 14:06 | Permalink | Mark Here
Jayenkai


WW Entries : 103
I'll have a look once I get home from work.


Welcome to Socoder, btw.

-----
Posted : Monday, 10 March 2008, 15:42 | Permalink | Mark Here
Jayenkai


WW Entries : 103
ok, I'll give you rough pointers, and you should be able to figure things out.

For each reel, create a "Ticker". This is a simple int number that starts high, then winds back down to 0.


When the player hits A, set ticker for the first reel to a random number.. Set the second reel's ticker to another random number, but one which is higher than the first. For the third, make it an even bigger random number.

Now, spin the reels, and keep counting those tickers down, one by one.
Once a ticker hits 0, stop it's reel from spinning.
Wait till all three tickers are at 0, and that'll be your time to jump into all the scorings, and things like that..

I've not bothered to give you a coded example, because... A) It's not really all that hard, so you shouldn't have any trouble implementing it, but also B) There's a multitude of ways you can do it. Whether you choose to use Arrays, or Structs, or even just a bunch of variables for each reel, or what ever else, it's up to you.

-----
Posted : Monday, 10 March 2008, 16:37 | Permalink | Mark Here
Afr0


WW Entries : 3
Pseudo code:

-->

-----
Afr0 Games

Project Dollhouse on Github - Please fork!
Posted : Tuesday, 11 March 2008, 08:56 | Permalink | Mark Here
spanner


So do i use that code Afr0 posted and where in my code do it put it,How do i connect the Tickers to the reels..?

I need to read up on c++..

-----
Span
Posted : Tuesday, 11 March 2008, 09:29 | Permalink | Mark Here
Jayenkai


WW Entries : 103
No, don't use precisely Afr0's code.. It's approximate code to help guide you on your way.

Mine's more explainatory, if you can follow the general gist of mine, you should be able to understand what's needed.

To connect tickers to reels, basically, instead of having A start the reels moving, have the reels animate when ticker > 0, and then, as soon as ticker =0, stop the reels again.


-----
Posted : Tuesday, 11 March 2008, 10:27 | Permalink | Mark Here
spanner


This is the ainimation of the reels and the press A button..

-->

So do i replace the PA_StartSpriteAnim(0, 1, 0, 7, 5 ); with the ticker...never done this before read abit about c++ but didn't have tickers in there..?

-----
Span
Posted : Tuesday, 11 March 2008, 11:22 | Permalink | Mark Here
mike_g


WW Entries : 6
Maybe take a look in the PA lib documentation. I'm pretty sure it should feature some method of getting the time but I dont know as I never used it myself. If not maybe look up gettimeofday and code your own ticker. Its a portable way to get the time, but i'm not totally sure if it will work on a DS.

As for randomisation PA lib might do that for you too if you look for it, also when using random numbers make sure to seed it something that will be variable, such as the time, otherwise it will give you the same numbers each game.
Posted : Tuesday, 11 March 2008, 12:46 | Permalink | Mark Here
Jayenkai


WW Entries : 103
The ticker described above does not require any timers, any special clocks, or anything like that.
I called it a ticker because it's something you'll be ticking away manualy.

Within your main loop, have something like this.

if (Ticker>0 ){Ticker--;}
(Obviously, you'll need 3 of these.. One for each reel. So you can probably use TickerA,B and C.)

When you set the ticker variable up to something like 120, it'll gradually reduce until it's back to 0.

So, when the player hits A, set the first reel's ticker to 100, then second to 140, and the third to 160. If you can get those randomly, that'll be better.

if (Pad.hit.A) {TickerA=100; TickerB=140;TickerC=160;}
And, set off the spinning like you did earlier.


Next, remember to keep the little reducer active, so it keep them ticking downwards, and once the ticker hits 0 again, stop the reels..
if (TickerA==0) {
// stop the 1st reel here.
}

if (TickerB==0) {
// stop the 1st reel here.
}

if (TickerC==0) {
// stop the 1st reel here.
}


And, that should roughly be enough.

Think of it like this. (assuming it were a real fruit machine..)

When you push the button, you set reel 1 off with enough momentum to pass 100 fruit, 2 with 140 and 2 with 160.
Then, as each fruit passes by the middle row, it clicks a little ticker which counts how many have gone by.
As soon as the momentum's done, the fruit machine knows how many fruit have passed, because it's been ticking along as it goes.

In our case, we're ticking backwards, but also using it to do the momentum too. It means rather than having both a momentum value, AND a ticker, we only really need one of them.
It's much easier this way.

-----
Posted : Tuesday, 11 March 2008, 13:09 | Permalink | Mark Here
mike_g


WW Entries : 6
Whoops, looks like I got a bit confused there o_0 Still getting the time will come in handy for seeding randomisation anyhow.
Posted : Tuesday, 11 March 2008, 13:18 | Permalink | Mark Here
Jayenkai


WW Entries : 103
Yeah, I can't remember exactly what the PALib Randomiser is, so I'll check it once I get back home.
It's not too bad, though.. quite like Blitz's

-----
Posted : Thursday, 13 March 2008, 12:15 | Permalink | Mark Here
spanner


Well i changed the code abit to use the PALib Randomiser, now you can start the reels with the start buton on the image.The problem is you press the start button and the reels turn and they try to stop but they don't but if you use the A button they work fine..?

See for yourself..

Reel Crazy Fruit Sim

Heres the code..


-->

-----
Span
Posted : Sunday, 16 March 2008, 18:01 | Permalink | Mark Here
spinal


try this...
-->

I didn't test it, but it should work, you need to chek if the stylus is newly pressed, the stylus location is always remembered by palib, so it will always be in the zone, even if you're not pressing it.


-----

3DS - 1762-2660-3218
Posted : Sunday, 23 March 2008, 10:40 | Permalink | Mark Here
spanner


Thanks spin that did it..
Posted : Sunday, 23 March 2008, 10:48 | Permalink | Mark Here
spanner


Now all i have to figer out is how to get the lights on the fruit machine to flicker at the right time with the reels.
so if a 1 and a 2 comes up the reel crazy name lights up 3 of its letters..

Any ideas..?

-----
Span
Latest Posts
Wrong Partition!!!!?
spinal Sat 11:24
Progress / Location Bars
Afr0 Sat 03:15
eBay Lies
spinal Fri 23:44
Shoutbox Topic - 968
dna Fri 19:42
Development via GUI
JL235 Fri 07:59
Meh
Afr0 Fri 04:13
Randomly distributed coordinates...
Afr0 Fri 00:20
Mog-Dog II : Electric Boogaloo
steve_ancell Thu 17:26
Matthew Smith making a comeback?...
steve_ancell Thu 03:59
Shapes
spinal Wed 12:21
More

Latest Items
News : Newsletter #176
Jayenkai Sat 04:49
News : Newsletter #175
Dabz Tue 09:38
Blog : Snow: More Material Junk
Cower Sat 23:17
Dev-Diary : Mutant Monty: Amstrad CPC to Windows conversion
rockford Fri 13:14
Techy : AppleTV
Jayenkai Thu 09:40
Blog : Graphviz
steve_ancell Sat 14:17
Pets : Top-Down Shadow Hack
Jayenkai Tue 05:52
Snippet : JNKrunch v1.0
Jayenkai Sat 07:20
News : Newsletter #173
waroffice Fri 04:47
Blog : Material Loading
Cower Fri 02:08
Pets : I Done Won A Thing
shroom_monk Sun 11:31
Pets : Repurposing A Lexer
Cower Mon 22:06
Bah : Feeling a Little Angry
spinal Mon 11:26
News : Newsletter #170
Dabz Sat 00:34
Showcase : sbfgen
Cower Sat 16:57
More

Who's Online
steve_ancell
Sat, at 15:08
Jayenkai
Sat, at 14:19
shroom_monk
Sat, at 14:00
dna
Sat, at 12:46
spinal
Sat, at 12:40
Afr0
Sat, at 11:46
rockford
Sat, at 10:30
9572AD
Sat, at 10:24
Dabz
Sat, at 10:09
Hotshot
Sat, at 08:39
Link to this page
Site : Jayenkai 2006-Infinity |
MudChat's origins, BBCode's former life, Image Scaler.