The Daily Click ::. Forums ::. Klik Coding Help ::. events for every frames?
 

Post Reply  Post Oekaki 
 

Posted By Message

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
22nd December, 2008 at 15:31:31 -

Hi!

I'm new to mmf and programing in general, but my first game is already near complete. It's a pong game with a challenge and a versus mode, so I wrote the events wich were needed in both, in each frame's events. First question, will this take more memory or something?

Also, I already started something more serious, a platformer with the player made from two active object, (legs) being attached to the(body). I thought I could write the spawn and reposition events of (legs)in the (body) personnal events, so that whenever I change frame and create (body again), it's personnal events would be triggered, so that I wouldn't have to write it back in every single frame, but it doesn't work. It works fine in the first frame because both objects are already there, but when I change to another frame, (legs) doesn't follow.

I also tried to put these events in the global events but still, I've got just the upper part of my character.

I'm pretty sure there must be a way say that at the start of any frame, if an object is present, something happens, but as you see I can't seem to figure it out.

I hope I'm clear enought since I don't have a lot of occasion to practice my english.
And thanks to all who'll answer!

 
...

OMC

What a goofball

Registered
  21/05/2007
Points
  3309

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
22nd December, 2008 at 15:35:27 -

Make sure the global object option is checked in the objects' property boxes.

If it isn't, the game won't recognize an instance in another level as the same one that's in the first level.

Edited by OMC

 

  		
  		

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
22nd December, 2008 at 16:26:31 -

I tried but I doesn't change anything. I'll let everything needed global thought.

To be more precise on what I did:

In (body) events ->
start of frame - create (legs) at 0,15 from (body)
always - set (legs) at 0,15 from (body)
if press right - direction of both right
if press left - direction of both left

In frame 2 events ->
start of frame - create (body) at let's say 50,300

shouln't (legs) follow?

 
...

OMC

What a goofball

Registered
  21/05/2007
Points
  3309

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
22nd December, 2008 at 16:35:27 -

Try this. Rather than have the legs created at start of level, compare to the number of legs onscreen. By the time the body exists, it's no longer the start of the level so the legs aren't created. Make sense?

So:
Number of legs < 2, create legs. Or, alternatively, if you need the legs to disappear later and not return, you could check to see if another external object's A value is 0 and set it to 1 once you've created the legs. I often keep a black box out of the playfield just to hold values.

Edited by OMC

 

  		
  		

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
22nd December, 2008 at 17:46:16 -

I've tried all of what you said.

I've tried even more like: If number of body > number of legs -> spawn.

While trying I've found that all theses events (even the start of frame you said wouldn't work) work if they are in each frame, but not in the global events or body events.

So if I put body and legs in a frame wich is never accessed, and I call both in every other frame, they position well.

I just wonder why it doesn't work the other ways.

And many thanks for the gobal value tip

Edited by Spitznagl

 
...

OMC

What a goofball

Registered
  21/05/2007
Points
  3309

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
22nd December, 2008 at 17:58:45 -

I'm a bit confused now. Would you be opposed to posting the mfa? I would only be able to open it if you don't use extensions though, because I only have TGF2. Never bothered to upgrade since I still use TGF1.

 

  		
  		

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
22nd December, 2008 at 20:53:20 -

Sorry for the wait.
I'm sending you an e-mail, in the hope you can find the problem.

Thanks

 
...
   

Post Reply



 



Advertisement

Worth A Click