How do I add score to a flappy bird style game?

Get help using Construct 2

Post » Wed Feb 17, 2016 1:56 am

Hi,

I've made many attempts to add scoring to Tappy Plane. My son wanted us to have a hobby something we could do together and since we both like games he suggested making games. So we are complete novices. So we've been trying to stick to simple stuff. We did the tutorial for Ghost Shooter and it turned out good. But my son wanted to do a flappy bird style game. So we gave it a try the only thing we can't seem to figure out is how to add scoring. I have read and watched tutorials but i must be missing something because it doesn't seem to work out. Any help would be greatly appreciated. Thanks in advance for any help. :)
B
5
S
1
Posts: 7
Reputation: 395

Post » Wed Feb 17, 2016 3:32 pm

Could try storing it in LocalStorage.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,857

Post » Wed Feb 17, 2016 11:57 pm

gumshoe2029 wrote:Could try storing it in LocalStorage.


I've tried storage and whatever else i can think of but it's just not only saving the score its getting a scoring system implemented in the game at all. I'm going to keep trying to figure it out and maybe i'll figure it out eventually. Any help is appreciated. :)
B
5
S
1
Posts: 7
Reputation: 395

Post » Thu Feb 18, 2016 12:14 am

@dwesley
Have you taken a look at the Flappy Bird tutorial here?
https://www.scirra.com/tutorials/857/fl ... 10-minutes
The tutorial itself doesn't cover the scoring, but the included capx has scoring in it.

Another possible way is to position an invisible sprite block over the pipes and when the player overlaps it would add +1 to the score variable.
B
61
S
33
G
109
Posts: 112
Reputation: 59,443

Post » Thu Feb 18, 2016 10:55 am

Message: dwesley can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Lancifer wrote:@dwesley
Have you taken a look at the Flappy Bird tutorial here?
https://www.scirra.com/tutorials/857/fl ... 10-minutes
The tutorial itself doesn't cover the scoring, but the included capx has scoring in it.

Another possible way is to position an invisible sprite block over the pipes and when the player overlaps it would add +1 to the score variable.


I have tried the Flappy Bird tutorial but I must have did something wrong. I haven't tried your second suggestion. I will give it a try. Thanks for the help. :)
B
5
S
1
Posts: 7
Reputation: 395

Post » Thu Feb 18, 2016 11:27 am

So I'm working on exactly the same type of game and this is what I implemented (I'm assuming you have a pipe sprite called "Pipe" and a bird sprite called "Bird"):

1. Keep a variable inside each of your pipe sprites called "Scored" and set it to false upon Create Object. This we will toggle once the pipe has a lower x-position than the bird (bird has "flown past", ie pipe has scrolled left past the bird). The reason for this is if we don't set Scored to true once the bird has flown past, it will continue to score that pipe.
2. Add first-level action "Pipe.X <= Bird.X" AND a condition "Pipe: NOT Is Scored" (Pipe is not Scored, ie. Scored is false) which will test ALL pipes for which Score is false's x-location against the bird's x-location and run a command if true. The command simply adds 1 to your Score variable ("Add 1 to Score") and sets the variable Scored to true FOR THAT PIPE (Pipe: Set Scored to true action). Again, this is to prevent the pipe from being scored on every tick.

There may be a more elegant way (you could investigate dwesley's invisible sprite method) which may be more processor-friendly, but this worked for me.

Hope this helps!
Last edited by BrandInMotion on Thu Feb 18, 2016 11:57 am, edited 1 time in total.
B
4
Posts: 6
Reputation: 216

Post » Thu Feb 18, 2016 11:57 am

BrandInMotion wrote:So I'm working on exactly the same type of game and this is what I implemented (I'm assuming you have a pipe sprite called "Pipe" and a bird sprite called "Bird"):

1. Keep a variable inside each of your pipe sprites called "Scored" and set it to false upon Create Object. This we will toggle once the pipe has a lower x-position than the bird (bird has "flown past", ie pipe has scrolled left past the bird). The reason for this is if we don't set Scored to true once the bird has flown past, it will continue to score that pipe.
2. Add first-level action "Pipe.X <= Bird.X" AND a condition "Pipe: NOT Is Scored" (Pipe is not Scored, ie. Scored is false) which will test ALL pipes for which Score is false's x-location against the bird's x-location and run a command if true. The command simply adds 1 to your Score variable ("Add 1 to Score") and sets the variable Scored to true FOR THAT PIPE (Pipe: Set Scored to true action). Again, this is to prevent the pipe from being scored on every click.

There may be a more elegant way (you could investigate dwesley's invisible sprite method) which may be more processor-friendly, but this worked for me.

Hope this helps!


I've tried this method and everything looked like it was correct but it didn't seem to work for me. I'm a complete novice so I'm still learning a lot of the ropes of construct 2. I will give this method a try again before trying the invisible sprite one. Maybe this time i'll get whatever I was missing before. Thanks for your help. Appreciate it. :)
B
5
S
1
Posts: 7
Reputation: 395

Post » Thu Feb 18, 2016 12:08 pm

Message: BrandInMotion can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
dwesley wrote:
BrandInMotion wrote:So I'm working on exactly the same type of game and this is what I implemented (I'm assuming you have a pipe sprite called "Pipe" and a bird sprite called "Bird"):

1. Keep a variable inside each of your pipe sprites called "Scored" and set it to false upon Create Object. This we will toggle once the pipe has a lower x-position than the bird (bird has "flown past", ie pipe has scrolled left past the bird). The reason for this is if we don't set Scored to true once the bird has flown past, it will continue to score that pipe.
2. Add first-level action "Pipe.X <= Bird.X" AND a condition "Pipe: NOT Is Scored" (Pipe is not Scored, ie. Scored is false) which will test ALL pipes for which Score is false's x-location against the bird's x-location and run a command if true. The command simply adds 1 to your Score variable ("Add 1 to Score") and sets the variable Scored to true FOR THAT PIPE (Pipe: Set Scored to true action). Again, this is to prevent the pipe from being scored on every click.

There may be a more elegant way (you could investigate dwesley's invisible sprite method) which may be more processor-friendly, but this worked for me.

Hope this helps!


I've tried this method and everything looked like it was correct but it didn't seem to work for me. I'm a complete novice so I'm still learning a lot of the ropes of construct 2. I will give this method a try again before trying the invisible sprite one. Maybe this time i'll get whatever I was missing before. Thanks for your help. Appreciate it. :)


Sorry, of course I meant Lancifer's invisible sprite method :)

As a newbie, try using the Chome Console plugin to log some debug data when your bird flies past a pipe (See log-text-amp-objects-to-chrome-console_t65979 for the download and read up on how to install plugins.) This data will show up in Chrome's Console tab (right-click on the html page and select Inspect from the drop-down list to show the console).
B
4
Posts: 6
Reputation: 216

Post » Thu Feb 18, 2016 12:58 pm

BrandInMotion wrote:
dwesley wrote:
BrandInMotion wrote:So I'm working on exactly the same type of game and this is what I implemented (I'm assuming you have a pipe sprite called "Pipe" and a bird sprite called "Bird"):

1. Keep a variable inside each of your pipe sprites called "Scored" and set it to false upon Create Object. This we will toggle once the pipe has a lower x-position than the bird (bird has "flown past", ie pipe has scrolled left past the bird). The reason for this is if we don't set Scored to true once the bird has flown past, it will continue to score that pipe.
2. Add first-level action "Pipe.X <= Bird.X" AND a condition "Pipe: NOT Is Scored" (Pipe is not Scored, ie. Scored is false) which will test ALL pipes for which Score is false's x-location against the bird's x-location and run a command if true. The command simply adds 1 to your Score variable ("Add 1 to Score") and sets the variable Scored to true FOR THAT PIPE (Pipe: Set Scored to true action). Again, this is to prevent the pipe from being scored on every click.

There may be a more elegant way (you could investigate dwesley's invisible sprite method) which may be more processor-friendly, but this worked for me.

Hope this helps!


I've tried this method and everything looked like it was correct but it didn't seem to work for me. I'm a complete novice so I'm still learning a lot of the ropes of construct 2. I will give this method a try again before trying the invisible sprite one. Maybe this time i'll get whatever I was missing before. Thanks for your help. Appreciate it. :)


Sorry, of course I meant Lancifer's invisible sprite method :)

As a newbie, try using the Chome Console plugin to log some debug data when your bird flies past a pipe (See log-text-amp-objects-to-chrome-console_t65979 for the download and read up on how to install plugins.) This data will show up in Chrome's Console tab (right-click on the html page and select Inspect from the drop-down list to show the console).


I'll try that. Thanks :)
B
5
S
1
Posts: 7
Reputation: 395


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 44 guests