The Daily Click ::. Forums ::. Klik Coding Help ::. bubble on box?
 

Post Reply  Post Oekaki 
 

Posted By Message

zharkman



Registered
  01/03/2009
Points
  27
5th August, 2009 at 20:27:36 -

u guys may be getting sick of me asking for help but here goes an other 1...

well what im trying to do is ksumthing like this
there is this box, see? well, i made a bubble that its supposed to be a shild, that goes on top of it, like... "select position" and then the coordinates of the current box
this works fine up to the point when its 2 or more, then i tried giving each box an alterable value and i had it spread that value so lets say
now i got 5 boxes
with their ids like 1,2,3,4 & 5 i did the same for the shields yet... i got no idea how to make the "bubble 1" go step on "box 1"
i've tried using strings... but i still cant get a hold of them things....
may i get some help please and thank you?

 
none

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
5th August, 2009 at 21:20:24 -

Spread value of 0 to both the bubbles and boxes in alterable value A.
Then use the "Compare two general values" condition to see if value A of the bubble is equal to value A of the box - then position the bubble accordingly.

Example file: http://www.create-games.com/uploads/zharkman_ex1.mfa

 
This is a signature. Have this one on me.

zharkman



Registered
  01/03/2009
Points
  27
5th August, 2009 at 21:27:49 -

hmm i think i understand what you mean... asnd the page sends me to a non existant page or sumthing thanks tho, ill try what u said

 
none

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
5th August, 2009 at 21:31:23 -

The server seems to be having trouble with .mfa files for some reason..
Try this one: http://www.create-games.com/uploads/flava/zharkman.zip

 
This is a signature. Have this one on me.

zharkman



Registered
  01/03/2009
Points
  27
5th August, 2009 at 21:36:56 -

i tried it and it came out screwy i think i did something wrong... but ur file works nao, i just gotta try it, thnx again

 
none

Flava



Registered
  30/07/2002
Points
  684

Has Donated, Thank You!Code MonkeyVIP MemberThe Cake is a LieThe Spinster
5th August, 2009 at 21:39:07 -

Remember to use the "Compare two general values" condition, which you can find under "Special" conditions. If you just use the "Compare to one of the alterable values" conditions it doesn't seem to work for some reason.

 
This is a signature. Have this one on me.

zharkman



Registered
  01/03/2009
Points
  27
5th August, 2009 at 22:30:50 -

i did it, thnx to you it works now! just one more question, lets say i want something to get sticked to it like... a plasma grenade from halo kind of effect, i throw a rock, it gets stuck on the shield and if the box falls or sumthing, its still sticked in the same position it hit the shield

 
none

MrMcFlurry



Registered
  03/08/2009
Points
  89

360 Owner
6th August, 2009 at 04:20:55 -

what you want to do for that, is, when the grenade hits the shield or target, or whatever, have it save the distance from the object where it collided

so, like, say your grenade had AValues A was distX, and B was distY

Grenade overlaps Bubble
+Grenade is moving (it'll only 'stick' the grenade once, if it's being thrown)
-Stop grenade moving
-set distX(grenade) to X(Grenade) - X(Bubble)
-set distY(grenade) to Y(Grenade) - Y(Bubble)
-Set ID(Grenade) to ID(Bubble) <- set the grenades id so it can pair them up

Then you have:

Grenade is not moving (<- should only be stopped if it has hit the shield, you can use some stuck flag or something if you rather)
+ID(Grenade) = ID(Bubble) <- compare two general values
-set X(grenade) to X(Bubble)+distX(Grenade)
-set Y(grenade) to Y(Bubble)+distY(Grenade)

that should do it, basically it records where relative to the bubble the grenade collided, and then sets a flag or status saying it has stuck, then constantly sets it's position to t he bubble's center + the relative position.


I believe the reason that doing a compare alterable value doesn't work is described in one of the articles, it's something about how mmf compares general objects versus specific objects, and by keeping both objects general, it doesn't make the confusion.

The alternative fix to that would be fastlooping, as that would instead compare specific objects to specific objects.

Edit: silly emoticons playingaround in my code :< ist, lol

Edited by MrMcFlurry

 
n/a
   

Post Reply



 



Advertisement

Worth A Click