The Daily Click ::. Forums ::. Klik Coding Help ::. MooClick Problem.
 

Post Reply  Post Oekaki 
 

Posted By Message

Leopardo



Registered
  28/12/2006
Points
  10
10th April, 2007 at 14:59:14 -

Hey. First sorry for my english...

I have a problem with this article: http://create-games.com/article.asp?id=1592

It's very good article. But, i'm creating a "football" game 1 on 1, and i want add to this a ball, with standard "bouncing ball" movement and i want make:

1) Ball, with sending her posistions to player's.

Please Help!

 
n/a

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
10th April, 2007 at 16:51:37 -

Every time you send co-ordinates to the other player, send the following information regarding the ball object:
it's position (x and y)
it's direction
it's speed

Then when the player receives, update the ball object with the new co-ordinates, new direction and speed.

 
My signature is never too big!!!

Leopardo



Registered
  28/12/2006
Points
  10
11th April, 2007 at 13:18:22 -

Um... maybe some "expressions", becouse i'm trying to do, what you write up and it doesn't work or i do something wrong ;(.

 
n/a

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
11th April, 2007 at 13:27:31 -

The way I do this is the host sends the new direction of the ball, whenever the direction of the ball changes on their screen and the position at which it changes direction. First you need to identify whether the client is the host, or whether it is the player connected to the host (I usually use a counter to do this - if they are the host, set the counter to 1. If not, set the counter to 0).

+ Counter is equal to 1
+ Ball collides with edge of screen
- Send text Dir( "Ball" ) on subchannel 1

+ Counter is equal to 0
+ Message received
+ Subchannel equal to 1
- Set direction of ball to text received

Then do the same for the position of the ball - which just makes sure there are no issues with lag. That should work, I think.. I've typed this out pretty quickly

 
This is a signature. Have this one on me.

Leopardo



Registered
  28/12/2006
Points
  10
11th April, 2007 at 13:48:22 -

Hm, i have stop at this moment:
(That is, what i do: )
+ Counter = 1
+ (Where is this option ?, sorry but i don't know, english that much to find it ;( )
- Channel: Str$(Dir( "Active 2" )) [Active 2 = ball, only Dir("Active 2"), not work.]

+ Counter = 0
+ This is : Playern Message, or Player: On Server Message, or Server -> Connection -> On Client Message, which one that is?
+ I don't know, how do this condition.
- And this too... ;(

This text up ^ whas based on your conditions, can you tell me what is wrong?


 
n/a

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
11th April, 2007 at 13:59:43 -

My post just shows you how to do it - I thought you could figure out from that, but if not here is the exact events:

+ Counter = 1
+ Ball collides with the background
- Channel: Str$(Dir( "Active 2" ))

+ Counter = 0
+ Player On Message
+ P_OnMessage_GetSubchannel( "MooClick" ) = 1
- Set direction to Val(P_OnMessage_GetText$( "MooClick" ))

For the ball collides with background event, surround the outside of the frame with backdrops of which the football is to bounce off. Unless you want the football to leave the play area - I do not know. Or you can use the "Ball leaves play area" condition, which can be found by New Condition > Active 2 > Position > Test position of Active 2.

To compare the subchannel of the message, you use the "Compare two general values" condition. This should have been used and explained in my articles as it is the same condition used to compare messages which send positions of the players.

MooClick only sends strings, and the direction of the ball is a value (not a string). To convert a value to a string, you surround the value by Str$(). This allows MooClick to send the value - when the value is received you can then set the direction of the football to the string received - however you need to convert the string back to a value using val().

You probably need to be more experienced in using the actual interface of MMF first, as it seems you don't know where to find some of the conditions and events - but I hoped this helped you somewhat. If you still can't find the stuff, then tell me whether you are using MMF 1.5 or MMF 2 and I shall create you an example file.

 
This is a signature. Have this one on me.

Leopardo



Registered
  28/12/2006
Points
  10
11th April, 2007 at 14:31:41 -

I do step by step what you write here, but... it still doesn't work ;( .

Interface of MMF, if you write "Ball colilides with the background", i understand this, but if you write "Ball collides with edge of screen ", i don't know which condition i have to choose .

I use MMF 1.5 .

 
n/a

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
11th April, 2007 at 14:46:09 -

To test whether the ball collides with the edge of the screen:

Image

 
This is a signature. Have this one on me.

Leopardo



Registered
  28/12/2006
Points
  10
11th April, 2007 at 14:50:43 -

N'ah, i can do it. I know how to do it, but i do something wrong becouse it doesn't work...

 
n/a

Aptennap



Registered
  23/04/2004
Points
  916
11th April, 2007 at 14:51:16 -

If you don't no what he means, then are you sure you should begin to make an online game? Thy are pretty hard...

 
Oh sweet mary.

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
11th April, 2007 at 20:19:01 -

Flava - I'm impressed by your patience and willingness to help people. Thanks for that.

Unis - I agree with Aptennap on this one. It seems that you're not all that confident in MMF, maybe you should work on some simpler games before tackling online? Online games aren't that difficult, but you will need a basic understanding of custom movements and how MMF works to make anything decent and lag free. Good luck.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
12th April, 2007 at 02:21:13 -

I have created a quick example file for you anyway Unis. It involves a slightly different method - rather then sending the new direction when the ball leaves the player area, it sends the direction whenever the direction of the ball changes. This means that the position and direction of the ball should be correct, no matter what obstacle the ball has just collided with.

Example file: http://www.create-games.com/uploads/unis_ball.cca

Hope it helps, however I still believe you should learn your way around MMF a bit more. Look at my example, read the comments and make sure you understand every event and what each event is doing. Hope it helps

 
This is a signature. Have this one on me.

Leopardo



Registered
  28/12/2006
Points
  10
12th April, 2007 at 11:28:35 -

Hm, if i click the link then : Page not found.
If i press right button and save element as, then i download it, but can't open it ;|

If i try open it in MMF, then write: "Cannot load aplication becouse it was saved by an old version of this program.

If i try open it in MMF 2 then write: "Unkown format"


 
n/a

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
12th April, 2007 at 14:41:37 -

Sorry, seems there is a problem with TDC uploading thingy.
Try this: http://www.clickzine.net/flava/unis_ball.cca

 
This is a signature. Have this one on me.

Leopardo



Registered
  28/12/2006
Points
  10
13th April, 2007 at 10:41:51 -

Thanks for your patience, it works! But, there is one problem... only "server" can touch the ball. It means:


I have a "My Player" - Host.
And "Other Player" - Join.
And i have condition to "My player" collision with ball -> ball bounce. And, it send posistion (if ball has been touch by Host player). But if ball is "touched" by Other Player, then "not send position".

 
n/a
   

Post Reply



 



Advertisement

Worth A Click