Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Tigre Pablito

Pages: 1 ... 13 14 [15]
211
General / Re: C++ SFML, Circular Movement - Help!
« on: September 19, 2013, 04:45:16 am »
you can convert degrees to radians by :

radians = degrees * PI / 180.0

and if i m not wrong, the paddle s absolute position would be, as zsbzsb said, but adding it to the center of the circle:

paddle.Position = new Vector2f( cos(angle) * radius + 320, sin(angle) * radius + 240 );

where 320,240 would be the center of the circle, from where its radius moves the paddle, ... actually, the paddle s angle is taken between the segments from the center of the circle to the center of the paddle, and from the center to the paddle s origin point

another matter:
you would have to get the angle of the ball, including when it touches the paddle, or the circunpherence:
first you should give and initial angle to the ball, por example, 60 degrees
when it bounces with any ot the 2 paddles,

ballAngle = 180 - 2 * paddleAngle - ballAngle;
while (ballAngle < 0) ballAngle += 360; 

when the ball bounces with the circunpherence:
i see the circunpherence as a great polygon, as if it had too many edges, then we would have to get the angle of that edge or segment where the ball hits, and apply the same formula (as if the edges were static paddles):

let s suppose we have the (xHit, yHit) Point of where the ball hit. That point belongs to the circunpherence.
the angle would be:

angleCirc = ASin( (yHit - 240) / radius ) + PI / 2;     // this angle is already in radians

ASin is the function that returns the angle whose sine is x. Here the only way to get the angle is getting the Sine, that is Y / radius. Adding PI /2 (that is 90 degrees) is because the edge is normal to the radius
then when the ball bounces with the circle line, the new ball angle could be:

ballAngle = 180 - 2 * angleCirc - ballAngle;      // remember angleCirc is already in radians

Perhaps you will need to detect in every loop if the ball hits weather the circle wall or a paddle. I suppose you will need the trigonometrical functions again ...
please let us know if you need more help ...
I agree with zsbzsb ... it s very nice your idea, very original ... I won t steal it, cos i m very busy with my poor Sonic ... then, when you finish the game, please post the link to it

the last thing: don t you forget the goal lines?  ;)

I hope it helps   :) ... and also hope i m not wrong, i haven t tested it ... just into my mind  ;D

Pablo
(from Bs As Argentina)


212
Thank you, Ixrec ... I ll try to see the file you attached
It has already occured to me the error you mention, at another person s PC, i mean, the same error text 
This is very sophisticated ... Why on some PCs SFML apps work fine and on another ones they don t?
If i remember OK that person s system was Win 8 64 bit ... Could you tell me what is your system?
And may i ask to those Guys and Ladies who may know, what do I have to do to let my SFML apps run on all systems?
And please, if someone knows how to fix the memory issue ... perhaps some C#/SFML expert, I will thank very much ...
Could it be a "memory model" C# problem? Or a SFML.Graphics.Image Class problem? perhaps a phisical error on the image file?
Thank you
 

213
Hello Ladies and Guys from SFML

i m developing my own Sonic game, and my poor hedgehog runs out of memory ... my PC has 2 GB RAM, and my application uses at most 150 MB ... here you can see the program, and how it crashes at Zone 3 Act 1 or 2

https://www.dropbox.com/s/9ikj1kbm53oqpp3/Sonic%20the%20Hedgehog%20by%20Pablito.rar

Really i don t know if this has to do with SFML, or just with C# ... or perhaps with both

However it is, i would apreciate your help very much - if possible - ; otherwise, thanks the same, and sorry if this topic does nt concern to SFML

Respecting to the code that is always requested when posting, i don t know what files, classes, or methods to paste here, because (i understand) the program is an integrated system, then the error could be at any place, note that it is a runtime error, those are the most difficult to detect

i would have no problem to send or upload the entire code, or just the files (3 or 4) where it would be more probable the error is

Actually, the OutOfMemoryException is thrown ALWAYS by the Image() constructor at loading Zone3Act1.jpg, from where I suposse it could be a circumstance of the (SFML) Image class ... i mean, the Exception could have been thrown while assigning:

attribs = new byte[XLIM, YLIM];   // XLIM = 20000, YLIM = 2000

that occurs just before attempting to load the Image

The Images (2) fore and background, are loaded and splitted (as Laurent taught me) into 1000x1000 Texture[,] (local) and them, placed into (class members) Sprite[,] sprite, bksprite

If i should explain myself better, please let me know

Thanks for advance

Pablo

214
Hello Ladies and Guys from SFML

At some persons PCs' (not mine) my SFML and C# apps don t run, and the command shell says:
(more or less)
"I can t load csfml-graphics-2 DLL"

Does someone knows how to solve this problem?

Thanks

Pablo

this is one of the apps with what this occurs
https://www.dropbox.com/s/9ikj1kbm53oqpp3/Sonic%20the%20Hedgehog%20by%20Pablito.rar


215
Graphics / Collision Method? My Sonic the hedgehog SFML & C#.NET
« on: July 26, 2013, 06:03:22 am »
Hello Dear Ladies and Guys from SFML

Could you tell me if there is any 'Collision function' or method, for example, a function that returns true if two sprites join at some point(s)?
I hope I m not wrong at choosing the Forum (Graphics)

I need this cos at my Sonic game, there are some oblique objects, then I cant test the collision with a square or rectangle

please tell me the function name, and its class, for example:
bool Sprite.Collision(...)   (I already searched and tried this but doesn t exist)

here I give you the aplication, it is still on development
https://www.dropbox.com/s/9ikj1kbm53oqpp3/Sonic%20the%20Hedgehog%20by%20Pablito.rar

Thank you very much in advance

Pablo (Bs As Argentina)

216
General / How to avoid alpha blending on .gif images?
« on: May 20, 2013, 05:08:40 am »
Hi Ladies and Guys from SFML

Can you tell me how to turn off the alpha value on a .GIF image? That is, that it only should use RGB, not A, as is Alpha was 255 (opacity 100%)
I m guessing, but something like:
sprite.Alpha = false;    // I m using C# .NET, NOT C++
Actually, I tried to find some attribute or method that does this, but I didn t

I m making a better version of my Mario game, and one of the changes was to convert the .bmp images to .gif, as it is the same color quality and the .gif are smaller ...the .bmp displayed alright, but some of the .gif, mainly those converted from .png files, does nt display, or display with some transparency

Or could you tell how to delete phisically the alpha channel from the .gif files?
I m sorry, I m very bad as an artist. Programming I stand better.
Exactly my problem is being that Kuppa, at the castle end, started invisible, then semi-transparent, and many other enemies flashes, cos some .gif don t display, plus Mario sprite images transparent color is not transparent ...
is there any problems with .gif images?

What does work fine is the transparency effect of the water, and the lights in the cavern, that are .png files (cos they need alpha)

Thank you very much!

Pablo
Bs As Argentina

217
Hi
I m using SFML 2, I suppose, I downloaded it, the folder s name is  LaurentGomila-SFML.Net-b8d7773, I think it s SFML 2 (for C# .NET), the DLL s came already compiled, but the source is there too
In my .rar file, the DLL s (8) are along side the EXE, as it is in the link I gave you in my last thread, ... when you have a little time, if you want you can see it

one of the persons who experienced this crash, sent me the command shell screenshot that contains the letter I translated onto this thread

Isn t there any way to link the EXE with the DLL s statically? I think that would avoid many problems

About my compiler settings, what I could see is .NET Framework 3.5, Console Aplication

I didn t understand what you meant with "hopefully you can read this back" ...

Thank you

218
ZSBZSB, you solved my last problem ... I wrote this after that, but I suppose I should have started a new post or thread, as I did then
I QUOTE FROM ME:

I used the event handling as you told me and now the problem disappeared  , you were right that Windows thought my app wasn t responding cos of the stack up of events, so I thank you, and all those who replied, and also those who have viewed this post (or thread), I see it has more views than most ... I don t know if many ladies and guys from SFML would have been seing my Super Mario game  ... I ll never know ... anyway, get ready for the next version, it s much better 

There s another problem, that happened 2 times to me, on other persons' PCs, and don t know on how many others could happen, cos I want to distribute my game:
The application crashes and the command shell says:
"Unhandled exception: System.IO.FileNotFoundException: Unable to load file or assembly ´sfml-graphics-2´, Version 0.0.0.0, PublicKeyToken = null, neither one of its dependencies. System can t find the file.
.......
AVS: The assembly linking register is disabled.
To enable the assembly linking error register, set the register value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) as 1.
Note: Exists a performance decrease related to assembly linking error register.
To disable this issue, delete the register value [HKLM\Software\Microsoft\Fusion!EnableLog]."

This nice letter is in Spanish, I hope my translation is Ok.

The OS in what this occurs is Windows 7. Mine is W 7 too, and here my program runs fine. I know very little about OS s ... I think I should enable or disable something, as it says in the letter, but don t know what nor where, nor how ... Could you help, once again? 

Note: The "yellow faces" were deleted at coping and pasting my message, let yourselves excuse me

219
General / Cant read DLL s on some PC s - My Mario Game with SFML
« on: May 16, 2013, 03:21:35 am »
Hello, Ladies and Guys from SFML
I ve done a Mario game with C# and SFML, and in some PC s (Windows 7 as most), it throws a strange exception: (in brief) "Cant read sfml-graphics-2 cos the linking error register is disabled" (more or less)
I already detailed the message from the command shell on my last post, when was solved my last problem
I suppose it cant read other dll s either, not only sfml-graphics-2 ...
My intention is to be able to run my Mario game in all PC s, and dont know if this has to do directly with SFML, but I ll thank those members who can help me to enable the thing that allows my application to read the SFML DLL s and then to run
Pablo
Buenos Aires Argentina

220
General / Re: My Mario game crashes if I click the mouse
« on: May 11, 2013, 05:43:52 pm »
I used the event handling as you told me and now the problem disappeared  :), you were right that Windows thought my app wasn t responding cos of the stack up of events, so I thank you, and all those who replied, and also those who have viewed this post (or thread), I see it has more views than most ... I don t know if many ladies and guys from SFML would have been seing my Super Mario game  8) ... I ll never know ... anyway, get ready for the next version, it s much better  ;)

There s another problem, that happened 2 times to me, on other persons' PCs, and don t know on how many others could happen, cos I want to distribute my game:
The application crashes and the command shell says:
"Unhandled exception: System.IO.FileNotFoundException: Unable to load file or assembly ´sfml-graphics-2´, Version 0.0.0.0, PublicKeyToken = null, neither one of its dependencies. System can t find the file.
.......
AVS: The assembly linking register is disabled.
To enable the assembly linking error register, set the register value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) as 1.
Note: Exists a performance decrease related to assembly linking error register.
To disable this issue, delete the register value [HKLM\Software\Microsoft\Fusion!EnableLog]."

This nice letter is in Spanish, I hope my translation is Ok.

The OS in what this occurs is Windows 7. Mine is W 7 too, and here my program runs fine. I know very little about OS s ... I think I should enable or disable something, as it says in the letter, but don t know what nor where, nor how ... Could you help, once again?  ;D

221
General / Re: My Mario game crashes if I click the mouse
« on: May 10, 2013, 10:18:50 pm »
No, I m a programmer since I was 16, now I m 33. Although I know I still need to learn so much, specially what concerns to multi threading, but I ll follow your advise, I won t use it, you re right that s not necesary

I ll do this, I ll try to use Event Handling, and then if the problem doesnt go away, I ll write a minimal but complete code example that recreates the application crash at mouse clicking, I suposse you guessed well that there is an overflow in the event queue

Could you tell me where to find the Event handling tutorial, or pass me the link? (for C# .NET) I can t find it with Google
I tried this:

App.KeyPressed += new EventHandler(App_KeyPressed);
App.KeyReleased += new EventHandler(App_KeyReleased);
App.DispatchEvents();

But the events were not launched, keys doesn t reply, I don t know how to use them in SFML

Thank you for all
////
Have you seen my game? I know it isn t the most professional, and I can t draw very well, ... but I think it s quite interesting ... What s your opinion?

222
General / Re: My Mario game crashes if I click the mouse
« on: May 10, 2013, 07:57:05 am »
I m not using the Events, I m just using Keyboard.IsKeyPressed(), ... I feel I can guess it s wrong? Anyway, the game works. Could this be the cause of the crash? I don t suposse that an input that is not read by the program may cause it crash
Well, I ll see if using the Events solves my problem, ... I was ignoring them cos I have the intention to use multiple threads in my program soon, and thought that using that class would make it impossible ... I suposse I m wrong in this too
Then I tell you
Thank you

223
General / Re: My Mario game crashes if I click the mouse
« on: May 09, 2013, 04:15:25 pm »
Hello
the code is quite extense, but here you have the link to it (is C#)

https://www.dropbox.com/s/5ejes56atnwbm40/CODIGO%20FUENTE.rar

it just builds the exe file,
if you want to test the program, there should be the data files, that is the folders GRAFICOS and MUSICA at the same directory level than the exe, and also the dll s, as it is in the link I passed in the previous post

Warning: the code is quite untidy; and if needed to translate it to English, please tell me and in 1 or 2 days I will ... I m sorry, sometimes neither do I understand my code

Thanks for replying
Pablo

224
General / My Mario game crashes if I click the mouse
« on: May 09, 2013, 12:51:42 pm »
Hello Ladies and Guys from SFML
I made a Mario game with C# .NET and SFML,

https://www.dropbox.com/s/akpuofnp6tdro7e/Super%20Mario%20Bros%20by%20Pablito.rar

My problem is that if I click the mouse while it is running, it immediatly crashes.
I tried to disable the mouse but just was able to set it invisible
If the applicaction is minimized it also crashes at restoring
A letter appears like "Your app stopped working", but at its background the app still running Ok but the screen has turned gray ... and if I press "Wait for the app to respond", the letter leaves and appears once and again

If you want, you can see this by yourselves, downloading and running the program

Could you help me,  and my program to be mouse clicking safe?
Thank you very much

Pablo Marty (Bs As, Argentina)

PS Now I m working in a very nicer version

225
Graphics / Need to set alpha of an image - and my game with SFML
« on: October 24, 2012, 12:39:08 pm »
Hello Ladies and Guys from the Forum
I m Pablo from Bs As Argentina, I made a Mario Bros game with C# and SDL, then I moved to SFML cos in SDL didn t work the direct input functions and had no support for C#, and I needed to use Threading and ignore the Events ...
Since yesterday I have been translating the SDL code to SFML ... there were 800 errors, now remain 6, that are about the Alpha component ... I dont know and couldnt find how to set the alpha value to an image (to all its pixels) ... and I need this for the ilumination in some levels of my game
Something like
image.Alpha = 128;  //(and all the pixels should be ARGB(128, R, G, B))
or whatever it is the syntax
Thank you
Then when I solve this I ll send my game for you
Pablo

Pages: 1 ... 13 14 [15]