Making a game with B4PPC

pmu5757

Member
Licensed User
Hello,
I'm trying to make a game with B4PPC.
The room where it takes place is big (3000 X 3000 pix).
It's bigger than any form I can create.
So I want that the form could "see" only a part of the room.
To do that, I used sprites : yhe jpg file where I've drawn the background is not set as the background of the game window, but is the image of a sprite that I called "map".
So, during the game I make move this map-sprite, so the player believes that he moves.
It works, but moving a so big sprite is maybe not the better idea...
Any better idea ?

Thank you.
 

klaus

Expert
Licensed User
Longtime User

pmu5757

Member
Licensed User
Thank you Klaus for your answer, but I'm afraid I don't understand your two examples. They seem to be to complicated for me :-(
I've read your subs but I can't find the place where the part of the image is drawn on the form.
Woul you have something more simple for a beginner like me ?
Thank you.
 

pmu5757

Member
Licensed User
Thank you Klaus.
I understand now.
I'm gonna try to use it, but without the scrollbars : im my game, it's the movements of other sprites that wil make the background move.

Best regards.
 

pmu5757

Member
Licensed User
Hello,
I tried the idiea of Klaus.
But here is my problem now : in the same program, I also use sprites. So I have a gamewindow for my sprites and it seems that the gamewindows is above the image I've included with the imagelibex dll. So the image can't be seen.
:BangHead:
Could someone help me ?
Thank you
 

pmu5757

Member
Licensed User
Hello everybody,
And thank you Klaus trying to help me.

I used the example proposed by Klaus in my code.
When I run it, I have the error message joined in this post.

It's strange, because, using the debug tools, I noticed that it occurs the second time the sub "drawgraph" is called : the first time it works.

I also joined my code in this post.
The lines concerned are between 109 and 182

Thank you.
 

Zenerdiode

Active Member
Licensed User
B4X:
Sub drawgraph
   bmpGameWindow[COLOR="Red"][B]s[/B][/COLOR].Dispose
   drwGameWindow.Dispose
   AddObject("bmpGameWindow","BitmapEx")
   AddObject("drwGameWindow","DrawerEx")
   bmpGameWindow.New2(formx,formy)
   drwGameWindow.New2(bmpGameWindow.Value)
   drwGameWindow.DrawImage(bmpImage.Value,rectSource.Value,rectDest.Value,False)
   gamewindow.DrawBackgroundImage2(bmpGameWindow.Value)
End Sub

Is it anything to do with your object being plural in places?
 

pmu5757

Member
Licensed User
I can't answer your question : I'm afraid I don't really undersdand how it works.
I just copied code from example given by Klaus.
I think you could have a look at this example to understand what kind of thing I'm trying to do.
This example is in this thread.

Thank you.
 

pmu5757

Member
Licensed User
Hello
I found another solution : I started with the example proposed by Klaus and I injected in it my code, my objects and my controls.
I did that using a temporary module.

Thank you.
 

klaus

Expert
Licensed User
Longtime User
Hi pmu5757,

I had a look at your program and have some comments.
Are you porting the program from VB ?

- the error you got in post #9 , like Zenerdiode pointed out, came from bmpGameWindows.Dispose.
- there are other typos in there: Ibouton.Texte must be Ibouton.Text
- lines Goto fin2, Goto fin3 can be replaced by Return
- be careful with the other Goto's, B4PPC is more tricky with Goto's than VB
- Goto debut with debut: not beeing in the same routine will not work, could be replaced by démarrer.Show
- Goto li could be replaced by:
liquidation
Return.
- Goto oups replaced by toure
-
Table2.LoadCSV (
AppPath & "\parties\" sel.Text & ".csv", ",", True, True)
should be
Table2.LoadCSV (AppPath & "\parties\" & sel.Text & ".csv", ",", True, True)

I couldn't look further because of missing pictures.
I answer only today, I was on travel during the last 5 days.

Best regards.
 
Top