Fruit Machine - problems!!
-
So I wanted to take a (very short!) break from my hex game and try to expand on my Fuze knowledge. Just a small project I could practice using functions on etc, so thought a nice simple fruit machine project would be good.
Already run into so many issues! So heres what I've got so far;
Not particularly exciting :)
So the issues are;
-
The output to get the symbols onto the screen is actually running through a multidimensional array reels[0-3] and then symbols [0-20]. The output is only showing 1 of the reels though
-
I suspect this is because is used the same sprite call for every symbol on each reel like this;
So i wonder if even though I'm trying to have for example symbols[reel1][symbol1]=appleSpr and the same for reel/symbol 1 and 2, whether as its pointing to the same sprite, its not possible to have that duplicated 3 times.
-
BTW, in that loop, I'm trying to space out the fruit to the reels using spriteLocation and then adding a value to X during each reel loop, which means they should be appearing on each reel. I dont think all 3 reels are stacked up in the screen shot...
-
Even if I could get that working, the next issue I've throught of is how to first randomly position the reel, so the middle line is a random symbol from the 20 on the reel - which obviously then leads on how to spin them, though I have a little idea about that.
===========
So there it is - a supposed "easy" project and I'm pretty disappointed (in myself) that I cant figure it out better than I have. I dont want to spend too much time on this and may from time to time just take on a 1 hour project to practice inbetween my strategy game - but I did think it was worth creating this post as I'm sure others have thought of doing a Fruit Machine, so maybe this could be somewhere the logic for one could be discussed?
Paul
-
-
Now you see why I chickened out from making one. ;)
-
Hey,
I think you are right, assigning all the reels like this will make all the reels point to the same sprite.
Instead of using the handle (
cherrySpr
) you'd need to do create a new handle for every symbol on every reel. So whatever you did to create cherrySpr needs to happen inside the loop. Maybe a own function for creating those sprites/symbols can be helpful.For drawing afterwards, you'd need to hide and show the sprites depending on whether they are one of the three to be shown or not...
Greetings, Mario
-
I made one of these once ( using a Dev kit which shall remain nameless) . My approach was to make images of the reels then move them up as they span. When a reel's image gets to the top it goes back to the bottom. The height of the reel can be controlled by an angle variable so that setting a random start position is simply a matter of setting random start angles.
Let me know if you'd like a clearer explanation. I was thinking of trying my hand at one of these myself. -
Thank @mario-bodemann and @DomDom both good ideas. I’ll definitely be back with an update and probably more questions!
@MikeDX also had a good solution on discord which I need to read a few times as may be above my understanding!
-
Here is a closeup picture of my attempt at this
-
By the way, did you draw the fruits yourself? I could not find any in the media vault.
-
Nice @DomDom !! I got it 'working' (not done much more since) but having an array of symbols. So AppleSpr[0], [1] etc. Not the most efficient way, but thats the great thing about coding, lots of ways to do things.
yea, the symbols took some finding, but I settled on "Ravenmore/platformPickups".
Some really nice graphics generally there too.
-
DomDom that is pretty awesome looking!
-
Thanks Steve. All for less than 100 lines of code. I will try to get around to commenting it then I will share it.
-
@SwitchedOn That's better! Thanks.
-
That looks superb @DomDom - how on earth have you got the 'curved' effect on the reels? That looks so cool.
I feel a bit silly for trying it myself now as I'd not be able to do what you've done here :(
-
Basically it involves using drawquad() with a dash sin()
I''ll post some kind of explanation soon but first want to refine one step in the process -
@SwitchedOn said in Fruit Machine - problems!!:
That looks superb @DomDom - how on earth have you got the 'curved' effect on the reels? That looks so cool.
I feel a bit silly for trying it myself now as I'd not be able to do what you've done here :(
My word, it looks incredibly good. I get frustrated as I wouldn't even THINK of doing that, let alone knowing how too. I'd love to see the finished code if you wouldn't mind.
-
Don't sell yourself short man. As I said, I've done this before. The first version started off looking a lot like yours. It wasn't until the basic version was up and running that the ideas for tweaks (and how to go about implementing them) started to arise. I expect you would have had much the same experience.
I'll post the code when it has been commented. -
FF633MND1U.
I haven't explained everything but I'm sure you'll get the gist
-
-
@DomDom said in Fruit Machine - problems!!:
FF633MND1U.
I haven't explained everything but I'm sure you'll get the gist
Thank you! Says "project not found" so probably not been put live yet?
But appreciate it thanks, looking forward to checking it out.
-
It has just been approved
-
thanks @pianofire