# Points Per Time?

Discussion in 'How Can I...?' started by Wael7, Aug 7, 2018.

Tags:
1. ### Wael7Boxer

Joined:
Jul 15, 2018
Messages:
5
2
Hello Boxers!
I have a really annoying issue that is preventing me from completing my game, I need your help because I have had enough already, my brain is about to explode literally!
I'm working on a game that has no 'Forced Movement', it's all in one scene, no ups no downs no lefts nor rights, the game will be amazing, but that one thing that's stopping me from continuing my work on it is that I cannot figure out how to have the score system running. I just need the game to add 1 point each second (time doesn't matter, I just need it to add points every given time or variable). I had this working in earlier BB versions, but I can't get it to work now... Only way the game can register points is only if the character moves up towards game direction (-90). However I don't want game direction to have anything to do with the scoring system because the game is static, it's not moving in any direction as mentioned above.

2. ### Phill MasonSerious Boxer

Joined:
Sep 25, 2015
Messages:
880
719
I have a few questions to better understand your issue.
1: If you had it working okay in an earlier version, why not go back and use that version to complete your game? Or, to study what differences have happened since the newer version that's not working.

2: Are you talking about BB2 or BB3?

If you have a static scene with a static character and you need to score points, the only real logical way I can think of at present, is to have the point find the character. I would attempt this with logic, spawners, transparent actions and a bit of magic

For example, if your character is in a set position, you could have a point/action/coin or similar spawn into your character from off the screen. The way you'd time it every second would be through some trial and error with the spawner frequency. So if your coin that gives you the point is off screen and a spawn frequency of, let's say 0.85, spits a coin with the right velocity towards your character, then it will collect the coin and award you the point. Hope that makes some sense?

I've done something similar to this some time back and it worked great. I can't remember if you can spawn actions or not, so if not, use what I call a 'movement block' or 'handle'. Basically it's just a small 10px square image I drop in and use as a handler, ie' something I can spawn or move towards my character, off screen and I attach the coin to it, so it collides with your character, that's another option.

Always difficult trying to answer questions without knowing what version you're using or no video or screenshots from your end. Anyway, hopefully some food for thought.

3. ### Wael7Boxer

Joined:
Jul 15, 2018
Messages:
5
2
Thanks for trying to help Phill, however that doesn't solve my problem. I'm using the latest version of BB2 (2.3.6). I have tried spawning coins that reward the character a point, but the problem is that you can't spawn actions, nor objects attached to actions or vice versa.
Also, I had it working in an earlier version (like 3 years ago) and I can't go back to it because it lacks a lot of functionalities that BB2 has today...
I remember I had the score set as distance, and the world was moving at a very low speed ( 0.00001 ) so the game stays static, with the score multiplier set at around 30,000. I obviously kept playing with these variables till I got it to be a 1 point per sec. However this doesn't work now, because the game registers points only if the player goes toward game direction, and when screen edge is reached, score doesn't go any higher.
I'm very upset because I have been working on this game for long, and if I can't have the score be by seconds, I have to redesign the whole game from scratch and make it another game... I wish BB would add this option ASAP!

4. ### Phill MasonSerious Boxer

Joined:
Sep 25, 2015
Messages:
880
719
Hi there @Wael7, I understand now and sorry, I couldn't remember without an open bbdoc in front of me, whether or not you could spawn actions or things attached to actions and as you rightly mentioned you can not. I also hope this will become a much needed feature in a future BB version as it appears many people require it.

I had a play around with a bbdoc (which I've attached for you) where I used a move block to drag the coin towards the character, perhaps you could use multiples of this hack, who knows???? I knew I did something similar in an earlier version and I thought it was spawn I used, but it was not, it was move an object attached to a coin, I also hope the BB Team add velocity feature to actions in the future, so we don't have to go through this hack each time.

This setup works perfectly. I've setup 1 scene for you with all the move assistants in plain view, so you can see what's going on. If this works well for you in your current game, just make all the move assistants "off-screen" or transparent and the user will not see what's going on, but you will be able to score points without moving your character. Simply change the velocity of the move assistant to match the speed at which you want your character to gain points. Good luck.

Enclosed - BBDoc - "Move Coin to Score".
Built with Version 2.3.5 but should open okay in 2.3.6
https://www.dropbox.com/s/v9568ewn9fgdfke/Move Coin to Score by Phill Mason.bbdoc?dl=0

Wael7 likes this.
5. ### Wael7Boxer

Joined:
Jul 15, 2018
Messages:
5
2
Thank you so much for your time Phill! I appreciate your help tons! However since my game is endless, will I have performance/memory issues, say if I have to make up to a thousand of it?

Phill Mason likes this.
6. ### Phill MasonSerious Boxer

Joined:
Sep 25, 2015
Messages:
880
719
That's a good point @Wael7 and I'm uncertain if performance would be an issue, without seeing your game and understanding how long you expect to survive in each session. I would imagine thousands of anything could affect performance.

Anyway, I had another play around this morning and have another idea for your to test.

I copied the 'coin' (Action) into the Defeated Animation of the 'Move Assistant' (object). This allows you to spawn the object, which is set to 'enemy' with '0 health' and '0 damage' so when it collides with the character, which has a '1 health' setting, it will award 1 point via it's oversized defeated animation, colliding with the character. As I mentioned earlier, I use small 10px x 10px coloured squares to help move things around in Buildbox as it helps to keep the atlas size down. So make sure you scale that coin up to cover the area where your character will be located. You can make it the size of the screen to be sure you'll make contact with your character when the enemy is defeated.

Finally, remember to change the spawn speed and/or the distance of the spawning enemy from your character, in order to get your desired collision-timing, speed. Hopefully this will give you your desired scoring system for your static character, good luck.

You can easily see what's going on in the "Start Scene" and I've made everything transparent in "Scene 01" so you can see how it would look to the end user. On Scene 01, remember to select the "Preview Selected Scene" button and not just the preview button at the top right, otherwise you'll see the Start scene again.

Enclosed - BBDoc - "Spawn Object to Score Points".
Built with Version 2.3.5 but should open okay in 2.3.6
https://www.dropbox.com/s/1pzihhm36ie0t00/Spawn Object to Score Points by Phill Mason.bbdoc?dl=0

Wael7 likes this.
7. ### Wael7Boxer

Joined:
Jul 15, 2018
Messages:
5
2
@Phill Mason, you're a genius, I appreciate you so much!
For fellow boxers that have this kind of issue, I have done exactly what you did but in another form.
I have made a 10px square for coin & movement block. I placed movement block on the right side of the game frame and made it transparent, with a velocity of -500 on the x axis, because the character can either be on the left side or the right side, so it's always 1 point per sec.
Thank you Phill so much, I really appreciate you!

Phill Mason likes this.

Joined:
Sep 25, 2015
Messages:
880