View Full Version : smurf game demo :)
Lionheart008
24-10-2009, 18:31
hello dear thinbasic friends :)
I have time and so I can follow something with FUN and learn more about new tbgl sprite features, but I have just some nice lacks to understand all around this great game features, so I will simple do it and make this game better.
I present here a first demo_beta. "smurfs are landing". there is built in a collision detection, but I have to read more and check it closer to avoid unclear movements of the figures ;)
I will add three figures they can act separately. I have to learn more about this one, but this morning and this afternoon I have done this first part. I hope you will enjoy it. I am open for critics, no problem. And one favour, I need help, would be nice to get it here (perhaps michael h., petr, michael c., kent, eros or somebody else can give good hints) :)
best regards, Demo I add as bundle exe plus pictures.
I would like to know if the three figures are too fast or too slow and the movements smooth ?
notice: only the female girl "schlumpfine" ("smurfina") can land at left basis (smurf house) or rightside (smurf house). - the smurf town (left side) has built in a soft collision. the right laughing smurf does still nothing but sinking ;)
a) one tipp: use arrows up, down, left, right to control "smurfina" :)
b) second tipp: try to control the black "smurfina" to the middle house for landing
'--------------------------------------------
you find new update here:
'--------------------------------------------
=>last edit: monday 02.nov.2009, evening, 22:32.
1) new 'lite-version' ready for testing !
screen resolution: 1024x768,32.
2) - move up,down,left,right keys to land smurfina (black one) on middle house
3) - uses w,a,s,d keys for moving the Heart to shot the Black Wizzard Gargamehl.
little nice effect, you can shot even middle or right house too ;)
=> this game part is ready! you have to handle two things: a) landing smurfina on middlehouse and b) shot the black wizzard. Enjoy it! :D
good night, thanks to mike and petr for help, servus, frank
Petr Schreiber
24-10-2009, 19:30
Hi Frank,
interesting example, but it reminds me a lot of the example with rocket landing.
I am not sure what do you mean by "best way to let move and act three or more figures separately". You create 3 sprite objects and simply apply what you need to each of them. Maybe you by accident add the same powers to the "smurfina" and the crowded scene block.
One thing - one of your fire sprites (sidefire.bmp) does not have correct color mask for transparency, this can be easily fixed by passing correct transparent RGB value - in this case 189,0,0.
What will be the goal and principles of the game? Will there be some scoring system?
Michael Hartlef
24-10-2009, 19:52
Sorry, can't run it. I just get a black screen because some textures are not in the power of two regarding their size.
Lionheart008
24-10-2009, 21:50
hi michael, petr, hello all :)
1) ok, I have loaded all pictures again in photoshop and saved again as bmp with 24 bit color depth. please try it again. must run, I hope so!
a) try to land the black (evil) "Smurfina" on middle house, that's all for testing. smurfina, the good one, beside here like the picture below.
b) if anything run's incorrect, please say it. sorry michael, I will check it again, if something is going wrong. here everything is running fine on win xp.
2) one aim of the game would be simple to land safe on the houses. but I will make some new hurdles and collision so it will be hard to get in the nearby for landing area ;)
3) yes, of course, a big part is from lunar landing game. but I would like to realize this children friendly game with smurfs :) I am not a friend of battle game, I like more strategy, adventure or fun games like this one may be one day.
4) highscore and effects will come too !
5) every figure now can land on one of the houses (basis). I have found my mistake!
info: new update see my first post.
best regards, frank
Michael Hartlef
24-10-2009, 22:26
I probably see only black because your background graphic is not in the power of 2. But its no problem. I have an emulated XP system so I can't judge performance anyway.
Lionheart008
24-10-2009, 22:36
hi michael, short question:
your background graphic is not in the power of 2
what properties must has such a picture ? how can I get this with photoshop ?
frank
Michael Hartlef
24-10-2009, 23:46
The Power of 2 means 2^n. 2,4,8,16,32,64,128,256,512,1024 are one of these numbers. The vertical size of 640 isn't.
Lionheart008
25-10-2009, 02:34
thanks for infos, oh, I see :)
@michael:
here I am sending 1024x768,32 tbgl window for testing. I add here only the exe file.
but my little notice for this scene: this 1024x768 tbgl window size haven't the smooth and velocity of my fullsize tbgl window. don't understand quite this different. nevertheless you can test this version I add here. the texture you may already have ;)
so long, good night, frank
Petr Schreiber
25-10-2009, 09:21
Hi Frank,
your attachement does not contain any bitmaps, so it crashes. Could you prepare new complete package and put it to the first post in this thread please?
Hard to say why the speed went down without source. My guess is the "classic" - you probably forgot to scale the movements to frameRate, so with different window mode possibly came different framerate resulting in different speed of animation.
You can try TBGL_VSync(0) before main loop to disable V-Sync, resulting in higher speeds.
Michael Hartlef
25-10-2009, 11:38
Hi Franck, by the power of 2 I ment the size of the textures. Neverless, having an not so comon size in the fullscreen resolution can cause problems on other systems too. For fullscreen modes you should always check if the system your script is running onto supports this resolution.
And like Petr said, without seeing at least some code, it is hard to judge any problems. But a common mistake is not to take the framerate in account for the calculation of sprite movement. If you don't do this, then on a slower environment it runs slower than on the faster one. That is why you can see the difference yourself by switching from fullscreen to windowed mode.
I hope to find time to create a sample for the windowed mode, which uses Petr's little trick with a timer. AstroCrusher rans very smooth because of this in windowed mode. Even on my snail system.
Lionheart008
25-10-2009, 11:59
hi petr, hi michael, thank you for this explanations :)
I have bundled all again, this time with all bitmaps again, see my first post. At my pc the first version in full size modus run very smooth and good. But I know other machines and graphic cards needs other specifications. I do my best. please try the new version and say how it works.
@petr: TBGL_UseVsync(1) is already implemented.
send the source code as pm to you (petr, michael). I will not open this one before it's perfect, you can imagine.
I hope to find time to create a sample for the windowed mode, which uses Petr's little trick with a timer. AstroCrusher rans very smooth because of this in windowed mode. Even on my snail system.
good to hear michael.
nice sunday, best regards, Frank Lionhead
Michael Hartlef
25-10-2009, 14:17
Here is the updated TBGL file you need to have children act on parents speed changes.
Lionheart008
26-10-2009, 17:33
hi all, hello michael. thanks first of all for the updated tbgl !
I would like to know what's the best way to give only "one message" when my nice black Smurfina is landing and stop there. I have tried it with three different possibilities. however the best and simplest solution is something like that:
If TBGL_SPRITECOLLIDED(schlumpfineEvil, sprpadmiddle) Then landings = 1 '%TRUE
IF landings = 1 THEN '%TRUE
MSGBOX hWnd, "Congratulations: Smurfina is landing! - You have won!",%MB_Iconinformation, "game_end" : stop
end if
End Sub
this way is very pretty but covers the display with more than 20-100 messages ! I wanted to stop the script when smurfina is landing and stay there on the middlehouse.
perhaps anybody has a good idea. I tried also to use a function for this problem, same result. is there any simple way for printing only "one message" and then "stop" the game?
nice day, best regards, Frank
Petr Schreiber
26-10-2009, 18:40
The problem was in game loop - it still wanted to be executed.
So proper handling in case of bound game loops is something like:
sub GameLoop()
...
If TBGL_SPRITECOLLIDED(schlumpfineEvil, sprpadmiddle) Then landings = 1
...
If landings = 1 Then
TBGL_UNBINDPERIODICFUNCTION(hWnd) ' -- No more forced execution
MsgBox hWnd, "Congratulations: Smurfina is landing! - You have won!",%MB_ICONINFORMATION, "game_end"
Exit Sub ' -- Leave politely
End If
...
end sub
Lionheart008
26-10-2009, 21:08
hello. dear petr, that's it! :)
now the first part of this little "smurf" game is ready! :D
everybody can use and test this first "lite" version. I am so glad to get finished it! and thanks to mike and petr for help, it's opening a new cosmos with "tbgl_2d" game features and it's so fantastic easy for handling! I am astonished.
=> GameInput: you need only to move "smurfina" (black shadow) on the middle house. use up, right, down, left key to control the figure.
BUT!
if you are doing silly things with for e.g. "gargamehl" (black old wizzard figure!) and he's landing on wrong house ... ähem... I don't say any words...
test your skills...
the next issue of "smurfs are landings" will be a difficult and evil version ;)
best regards, complete exe file in my first post!
ready to take off! enjoy this little game, very children friendly too :)
- feedback and critics are welcome -
frank lionheart
Petr Schreiber
26-10-2009, 21:18
Hi Frank,
the scene gets crowded.
I managed to land correctly, hurray!
Two problems found:
- landscape-murphs.bmp has still resolution of 1024x640, try to resize it (in IrfanView or other editor) to 1024x1024. This way it will work on cards without NPOT support
- the collision was slightly odd sometimes
I am curious about new version :)
Lionheart008
26-10-2009, 23:21
hi petr, thank you for testing. I will make new version end of week. something is strange here. the background picture I have made I resized to your supposed wish, but here I get fuzzed image like screen distortion. I will check it tomorrow.
the scene gets crowded.
I managed to land correctly, hurray!
I have good mood, if I am reading something like this one:
the collision was slightly odd sometimes
I must laugh loud. I have so many posts here at the forum or other ones (freebasic, powerbasic, c++).
you have humour too:) I am sure, you are very intelligent ;)
I say: collision was ligthly odd sometimes ???
"no! it's a feature!" that becomes to laughing me a lot! You can imagine!
ok! serious. I say NO! that's a real fact. If you try to collide an object to another one, this makes influcence to other objects in nearby, so I have intended so! No joke!
if you try to handle "black wizzard" to land he's getting some influence to the right landing base. I have tested it several times. that's the reason for me to make more hurdles for the next, evil issue. I like the idea to make a break or a wall to get through, you must suffer for a certain time to go forward. I love this kind of going make scores !
Like in real life :D
more to come :)
thanks for testing, I make up my mind for the bmp background. thanks for the hint, I often forget to include other graphic cards or os systems.
all work in progress, frank
ps: by the way: I would like to control one tbgl window with another one ;D
Michael Hartlef
27-10-2009, 11:45
Hi Franck,
about resizing the background. The easiest way is just to resize the canvas, leaving the new areas untouched. So your image will have some unused space. Which you could use for other grafics as well. ;)
Then, when you load it, by default the sprite will use the complete texture space of 1024x1024. But you can set the base size with TBGL_SpriteSetBaseSize and then the texture coords with TBGL_SpriteSetTexCoord. Just like I did in the collision sample I posted recently.
Michael
Lionheart008
27-10-2009, 21:52
michael, petr, all, hello :)
thank you very much for infos and help!
about resizing the background. The easiest way is just to resize the canvas, leaving the new areas untouched. So your image will have some unused space. Which you could use for other grafics as well.
- I have resized the background bitmap to 1024x1024, but changed no more "TBGL_SpriteSetBaseSize" or "TBGL_SpriteSetTexCoord". I will try this another day, I am totally groggy from work today :bom:
- petr: can you check the collision again ? must be smoother now and better.
info: two test-zip/rar file I send here. If they are ok I will post the package to first post.
best regards, frank
Petr Schreiber
27-10-2009, 22:25
Hehe,
nice Frank, no more problems with collision.
But the package does not work initially, as you named the background as landscape-murphs1.bmp. Should be just landscape-murphs.bmp. After this correction it works ok!
Lionheart008
02-11-2009, 22:12
hi, welcome back to the smurfs :) my pc is fit again, I am so glad!
new things around smurfs with collision and shots (lite-version!). that's one new very little problem with the background, if you shot with pushing the "space" key:
a) you can hurt or shot down "gargamehl" (the black evil wizzard) with the "heart". go with "w" key to move the heart to the nearby of black wizzard and push "space" key to shot him, so he will rotate ;)
b) if you repeat this shot access the background will rotate too. nice silly thing. I don't know why ? perhaps michael or petr can have a closer look at this part, would be nice.
I include smurf exe file plus new tbgl.dll here !
best regards, Frank
Lionheart008
02-11-2009, 23:28
thank you petr for prompted help!
things for the good "heart" works fine now, the background doesn't rotate any more if you like to shot the evil wizzard and you can do it now by a certain distance ! great! :)
=> the new running version I add at my first post!
good evening, best thanks, Frank Lionheart