The Daily Click ::. Forums ::. Klik Coding Help ::. Spread Value problem
 

Post Reply  Post Oekaki 
 

Posted By Message

superpower



Registered
  07/06/2010
Points
  27
7th June, 2010 at 19:04:41 -

Ok. So I just started experimenting with spread values and I am going to use them in a full game (because I have to), but I wanted to start small scale and can't still get it to work.

What I did is make an object, controller by the player, two red boxes and two green ones. I wan't one of the green boxes to be destroyed when I touch one of the red one's. So I did this:

- Start of frame
--- Spread value 1 in alterable value A (of the red box)
--- Spread value 1 in alterable value A (of the green box)

- When (player) is overlapping (red box)
+ Alterable value A (of red box) = Alterable value A (of green box)
--- Destroy (green box)

What it does is destroy neither of the boxes when I touch the one with Spread Value 2 and both when I touch the one with Spread Value 1...

Why, how, when and who!?

- Thanks

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
7th June, 2010 at 19:10:23 -


Originally Posted by superpower
- When (player) is overlapping (red box)
+ Alterable value A (of red box) = Alterable value A (of green box)
--- Destroy (green box)



Flip the middle one around to Alterable value A (of green box) = Alterable value A (of red box)

 

  		
  		

superpower



Registered
  07/06/2010
Points
  27
7th June, 2010 at 19:16:24 -

Thank's hugely!

But... Why is it so important. How do I know in the future which way to put it?

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
7th June, 2010 at 19:17:59 -

The specific green box has to be the focus of the condition. The way it was, MMF was checking the red box's value. Well, yea, it equals one of the green boxes' value, but since the red was first, it's the focus. So MMF doesn't know which green box to destroy. It works logically to a thinking person, but not MMF, unfortunately.

When something doesn't work that should work, try flipping things around or looking at order of events.

Edited by OMC

 

  		
  		

superpower



Registered
  07/06/2010
Points
  27
7th June, 2010 at 19:27:25 -

Actuall that kinda makes sense in a weird way. Thanks again. Still got loads of problems left though, with my real application

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
7th June, 2010 at 19:32:34 -

No problem! Feel free to post your other questions. If I can't help you with them, I'm sure someone more advanced can!

 

  		
  		

superpower



Registered
  07/06/2010
Points
  27
7th June, 2010 at 19:40:57 -

One more thing actually.

Always when I wan't to make something happen I need two instances with a spread value, a unique ID.
What if just want to make a specific enemy follow me to the right. Let's say I do something like this:
- X position of "player" is less than X position of "enemy"
+ every 0,03 seconds
--- Set X position of "enemy" to "enemy" X-cordinate -3

How do I make the spread value ID thingy useful. What I'm saying is that I can't compare "enemy" spread value to anything. Is there any way to still utilize the unique quality of his "ID" or do I have to make a detector of respective value to match?

Edited by superpower

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
7th June, 2010 at 19:46:50 -

How do you want the enemy to be selected? If they're close enough to you? If that's the case, we can use the distance formula. But I'm not sure what you're asking.

 

  		
  		

superpower



Registered
  07/06/2010
Points
  27
7th June, 2010 at 19:50:32 -

I wondered if it's possible to make the ID of the specific instance of the enemy useful without having to create another object to match.
For example this distance formulae you mentioned.
Could you please post it?

Also, I've always wondered... Is there some place where I can find a sort of "legend" for the calculator expressions, i.e "Dir" means distance and so on?

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
7th June, 2010 at 20:13:51 -

I'm sure it is useful for other things, but I still don't follow...

The distance formula is the square root of this:
(X2 - X1)^2 + (Y2 - Y1)^2


Which, when translated to MMF and used with two objects that we'll call Player and Enemy, becomes this:

Sqr((X( "Enemy" )-X( "Player" )) pow 2+(Y( "Enemy" )-Y( "Player" )) pow 2)


You could use compare two general values, with this in the first one, and your minimum desired range in the second one. Like this:

Sqr((X( "Enemy" )-X( "Player" )) pow 2+(Y( "Enemy" )-Y( "Player" )) pow 2) is less than 50 >> Set Value Whatever to 1.

Value Whatever = 1 >> Make enemy follow Player


So if the distance between the objects is less than 50, the enemy follows the player.

As for a calculator legend... I could tell you what each button does, but I wouldn't be able to remember all of the expressions you can get like "dir" and "speed". I'd like to see a legend too! Maybe someone else knows of one.

Edited by OMC

 

  		
  		

superpower



Registered
  07/06/2010
Points
  27
7th June, 2010 at 20:30:29 -

While we are on the topic of well... pretty much anything that comes to mind
Is there like a way to make the enemy check if anything is between the player and him without using hitboxes? Using the distance formulae wouldn't really work that well with platforming otherwise. Since he could essentially see you through the ceiling and still follow you around like a dog begging for food at the table...

Oh. And cheers for the formulae I tried it out it could actually get really useful. Normally I don't use the calculator that much since I don't really like anything I "can't see". Call me old fashioned

Edited by superpower

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
7th June, 2010 at 20:59:24 -

Ah-ha! Here's an area where I've not wandered before. There are several approaches to line of sight.

A quick search brings up some interesting stuff...
Sketchy's fastloop LoS engine: http://www.create-games.com/download.asp?id=7524
Pixel-stretching Article by MrMcFlurry: http://www.create-games.com/article.asp?id=2137 (I'd try this one)

There are loads of others too, but some of them have dead links. I think I remember one by Codemonkey somewhere but I've got to run right now. Check them out and see if any fit!

Edited by OMC

 

  		
  		

superpower



Registered
  07/06/2010
Points
  27
7th June, 2010 at 21:19:21 -

Cool stuff!

Oh now I see. This is my first time online and I've always wondered why the search doesn't work Since it used to work for all users before

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
7th June, 2010 at 22:09:46 -

My article on duplicate objects etc (incl. links to other relevant articles)
http://www.create-games.com/article.asp?id=1975

Re: Line-of-Sight:
The pixel-stretching method is the best, unless you need to find the point where the line of sight is broken (you also *must* use the HWA build of MMF2).

 
n/a

superpower



Registered
  07/06/2010
Points
  27
8th June, 2010 at 18:16:37 -

Thanks a lot for the help! I'm finally getting somewhat of a hang of fast loops and spread value...

However, I still have a problem...
I'm trying to make some of the enemies to start walking right and some to start walking left at the start of the frame.

I've tried...

- Start of frame
+ 1 chances out of 2 at random
+ On Loop "Loop1"
+ ID of "Enemy Test" = LoopIndex("Loop1")

...and all other possible combinations, which leads me to believe that I'm doing something so fundamentally wrong that only you guys can help me with this

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
8th June, 2010 at 18:27:11 -

You probably don't need a loop for that. You never know though. What movement are you using? Is it built-in or custom?

Edited by OMC

 

  		
  		

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
9th June, 2010 at 06:01:25 -


How does Modulus work? .. Is that the thing that finds a remainder? .. How would that work?

I'm thinking you could devide the Alt Value by 2 and if that value's remainder is zero, make the enemy look left, but if that value's remainder is not zero, make the enemy look right.

But yea ... does Mod work like that?
How exactly would that be written if so?


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

superpower



Registered
  07/06/2010
Points
  27
9th June, 2010 at 08:08:27 -

I don't think it'll work without loops since every enemy will turn, whereas I want there to be a random chance for some of them to do it. And yes, I'm using a custom built movement engine (that I totally nailed last night, booyah!). However MBK here may be on to something. Since values are individual, I could maybe do it like this:

- run event only once (I like failsafes)
+Start of frame
+2 chances out of 5 at random
--- Change Alterable Value "Initial Direction" to 1

- run event only once
+ When Alterable Value "Initial Direction" = 1
--- Change "Initial Direction" to 0
--- Change Alterable Value "Moving" to 1 (1 moves enemy right and -1 moves him left, I make them start of with -1 by default)

Can't wait to try it when I get home

 
n/a

superpower



Registered
  07/06/2010
Points
  27
9th June, 2010 at 17:01:17 -

I just tried out multiple enemies in the game and it seems I have this really weird bug. Depending on how high in the air I place them, in relation to each other, after falling down, they will either fall through the floor, stand still or run around (they should be running around). Nothing should be wrong with the movement engine itself, which leads me to believe that it's another spread value problem. I've tried both:

- Start of frame
--- Spread Value 0 in ID of "Enemy"
--- Spread Value 0 in ID of "Enemy Sprite"

- Always
--- Set position of "Enemy Sprite" at 0,0 from "Enemy"



and




- Always
--- Start loop "loop1" NObjects( "Enemy" ) times

- Start of frame
--- Spread value "0" in "ID" of "Enemy"
--- Spread value "0" in "ID" of "Enemy Sprite"

- On loop "Loop1"
+ ID of "Enemy" = Loopindex("Loop1")
+ Always
--- Set position of "Enemy Sprite" at 0,0 from "Enemy"



I've also tried flipping around and playing around with the "Start of frame" and "Always" functions just in case...
Any ideas!?

- Thanks again TDC!

Edited by superpower

 
n/a

superpower



Registered
  07/06/2010
Points
  27
10th June, 2010 at 13:02:43 -

I've actually solved that now. I just had a bunch of events in the wrong order
However, now there appears to be yet another problem

Since my sprite is a different object to the "enemy" object itself I have used these spread value events:

- Start of frame
--- Spread value 0 in "ID" of "Enemy"
--- Spread value 0 in "ID" of "Enemy Sprite"

- Always
--- Set position of "Enemy Sprite" to "Enemy"
--- Set direction of "Enemy Sprite" to "Enemy"

But how can I make more complex things like changing between animations possible.
I now have it set up like this:

- Alterable value "Moving" of "Enemy" = 1
+ Alterable value "Falling" of "Enemy" = 0
--- Change "Enemy Sprite" animation to "walking"

And this doesn't work since MMF doesn't know which Enemy sprite needs to change it's animation sequence.

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
10th June, 2010 at 15:22:03 -

Yes, separating objects can be a big pain in the patooter!

I might try sticking a condition at the top of that event: "ID" of enemy sprite = "ID" of enemy
Not sure if it will work but it might.

If it doesn't, a workaround should be put in place. Perhaps have a value box (an active placed outside of the frame that just hold values--I love those). Then do this:
- Alterable value "Moving" of "Enemy" = 1
+ Alterable value "Falling" of "Enemy" = 0
>> Change Value Box value "Enemy ID" to (animation number). (When you go to the change alterable value menu, hit "use expression" by the value selector. Then get the enemy's ID)

Always: Set enemy sprite animation to Value Box "Enemy ID". (Use Alterable value by index and get the Enemy ID here).

Or come up with something else creative!

 

  		
  		

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
10th June, 2010 at 16:35:53 -


Originally Posted by superpower
I've actually solved that now. I just had a bunch of events in the wrong order
However, now there appears to be yet another problem

Since my sprite is a different object to the "enemy" object itself I have used these spread value events:

- Start of frame
--- Spread value 0 in "ID" of "Enemy"
--- Spread value 0 in "ID" of "Enemy Sprite"

- Always
--- Set position of "Enemy Sprite" to "Enemy"
--- Set direction of "Enemy Sprite" to "Enemy"

But how can I make more complex things like changing between animations possible.
I now have it set up like this:

- Alterable value "Moving" of "Enemy" = 1
+ Alterable value "Falling" of "Enemy" = 0
--- Change "Enemy Sprite" animation to "walking"

And this doesn't work since MMF doesn't know which Enemy sprite needs to change it's animation sequence.



There's no point in spreading a value if you're not going to compare it later.
All "spread value" does is give each instance a different value (starting with the number you specify, which is allocated to the most recently created instance) - it doesn't magically pair objects up by itself.

Your first example would still have worked even without spreading a value, just because in this situation, MMF knows to pair objects according to the order in which they were created.
You could apply the same principle to your second example, using one of the "Enemy" object's alterable values to store the animation sequence of the corresponding "Enemy Sprite".

eg. Something like this:

- Alterable value "Moving" of "Enemy" = 1
+ Alterable value "Falling" of "Enemy" = 0
--- Set AnimSeq("Enemy") to 1

Always
--- Change animation sequence of "Enemy Sprite" to AnimSeq("Enemy")
(You need to click the "Use a calculation" button when selecting an animation sequence; 0=Stopped).

Alternatively, you could do it the way you have already tried, in which case you need to include the condition "If ID("Enemy Spite") = ID("Enemy") as OMC suggested.

 
n/a

superpower



Registered
  07/06/2010
Points
  27
10th June, 2010 at 17:26:01 -

I've tried the "If ID("Enemy Spite") = ID("Enemy")"-way, but it just doesn't work, and I just read an old article by Tigerworks that explained why it doesn't. This means that to me, spread values are pretty much useless (what a relief). But what amazes me the most is that your way, Sketchy, seems to work fine. Why it does, I don't know... I just added an extra alterable value called "animation" to the "Enemy" object and made it change it's value alongside the "moving" value. However, how the sprite knows which "enemy" objects value to use is frankly beyond me...!?

Could you please explain...!?

PS.
Something that would be seriously cool would be a way to spread value in global values. Now that I could use!

Edited by superpower

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
10th June, 2010 at 17:56:23 -

In that case, it must be:
"If ID("Enemy") = ID("Enemy Spite")"

instead of:
"If ID("Enemy Spite") = ID("Enemy")"

The two are not the same, and I get them mixed up sometimes.
I assure you, if you have everything ordered right (it also needs to be the first condition in the list), then it will work fine, and is actually the way I would recommend.

Re: The other method I described -
As long as you don't add any other conditions which would cause MMF to focus on a specifc instance (or instances), then it will always pair objects according to how recently they were created.
If you say: "Always position Object_A at 0,0 from Object_B", then each instance of Object_A will position itself over a different instance Object_B.
The newest instance of Object_A is paired with the newest instance of Object_B; the next-newest instance of Object_A is paired with the next-newest instance of Object_B; and so on...

I think this article by Pixelthief might kind of explain it:
http://www.create-games.com/article.asp?id=1942

Re: Spread <value> in Global Value -
How would that even work? There can only ever be one of each global value.
If you mean that you want to set GV_A to 0, GV_B to 1, GV_C to 2, etc - then it's quite easy, but I don't see how it would be useful.

- Whenever
--- Start Fastloop "SetGlobal", "26" times <-- or however many global values you want to change

- On loop "SetGlobal"
--- Set Global: LoopIndex("SetGlobal") to LoopIndex("SetGlobal") <-- you need to click the "Edit" button next to the list of global values.

Edited by Sketchy

 
n/a

superpower



Registered
  07/06/2010
Points
  27
11th June, 2010 at 07:54:13 -


Originally Posted by Sketchy
In that case, it must be:
"If ID("Enemy") = ID("Enemy Spite")"

instead of:
"If ID("Enemy Spite") = ID("Enemy")"

The two are not the same, and I get them mixed up sometimes.
I assure you, if you have everything ordered right (it also needs to be the first condition in the list), then it will work fine, and is actually the way I would recommend.

Re: The other method I described -
As long as you don't add any other conditions which would cause MMF to focus on a specifc instance (or instances), then it will always pair objects according to how recently they were created.
If you say: "Always position Object_A at 0,0 from Object_B", then each instance of Object_A will position itself over a different instance Object_B.
The newest instance of Object_A is paired with the newest instance of Object_B; the next-newest instance of Object_A is paired with the next-newest instance of Object_B; and so on...

I think this article by Pixelthief might kind of explain it:
http://www.create-games.com/article.asp?id=1942

Re: Spread <value> in Global Value -
How would that even work? There can only ever be one of each global value.
If you mean that you want to set GV_A to 0, GV_B to 1, GV_C to 2, etc - then it's quite easy, but I don't see how it would be useful.

- Whenever
--- Start Fastloop "SetGlobal", "26" times <-- or however many global values you want to change

- On loop "SetGlobal"
--- Set Global: LoopIndex("SetGlobal") to LoopIndex("SetGlobal") <-- you need to click the "Edit" button next to the list of global values.



Neither "If ID("Enemy") = ID("Enemy Spite")" nor "If ID("Enemy Sprite") = ID("Enemy")" works, they just fall through the platforms. I might just be doing something else wrong though. I haven't yet developed a decent understanding of spread values, as you probably noticed from my "if you could spread values in global values" post.
Darn it! I always think of spread values the wrong way and never learn
I always seem to think that first it spreads through an alterable value, sort of "applying" the number of numbers (yeah, you heard right) for later use by the objects. Even though that doesn't make any sense to any of you, trust me, after 3 days of constant work on an AI engine, it did to me

And just to clarify, "how recently the objects were created" means how recently they were created after the application has started, not after I duplicated them in the frame?
Does that basically mean that they are assigned some sort of "number value" and then pair up with their corresponding numbers of different objects?

Edited by superpower

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
11th June, 2010 at 09:29:41 -

"How recently they were created" applies whether the object was created at runtime or in the frame editor.
eg. Spreading "0" in four instances of an object:
3 - First instance created in frame editor,
2 - Duplicate created in frame editor,
1 - First object created at runtime,
0 - Second object created at runtime.

And yes, objects *are* assigned "some sort of number value" - it's contained within their "fixed value" (for objects created in the frame editor, it's basically the number that appears when you click on them).
http://www.create-games.com/article.asp?id=2139

 
n/a

superpower



Registered
  07/06/2010
Points
  27
11th June, 2010 at 09:49:25 -


Originally Posted by Sketchy
"How recently they were created" applies whether the object was created at runtime or in the frame editor.
eg. Spreading "0" in four instances of an object:
3 - First instance created in frame editor,
2 - Duplicate created in frame editor,
1 - First object created at runtime,
0 - Second object created at runtime.

And yes, objects *are* assigned "some sort of number value" - it's contained within their "fixed value" (for objects created in the frame editor, it's basically the number that appears when you click on them).
http://www.create-games.com/article.asp?id=2139

I'll might have to look into this later, but for now, I don't need it.
At a quick glance though, seems like a nice article...

 
n/a

superpower



Registered
  07/06/2010
Points
  27
11th June, 2010 at 13:46:56 -

How do I do a function like "If number of objects whose alterable value is X"?
or
"Set alterable value of "object 1" to number of "object 2" overlapping "object 1"?

I'm only now starting to realise how limited MMF really is.
For example why can't you make the zone in "test for number of objects in a zone" relative to a particular object!?

Edited by superpower

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
11th June, 2010 at 16:16:54 -

Testing for the number of objects in a zone is just meant to be a quick and easy feature to help beginners - much like the built-in movements / shooting etc. If you need more control, you can easily code it yourself.

eg.

+ Always
-> Set In_Zone("Object_A") to 0

+ X("Object_A") > X_Zone_Center - (Zone_Width / 2)
+ X("Object_A") < X_Zone_Center + (Zone_Width / 2)
+ Y("Object_A") > Y_Zone_Center - (Zone_Height / 2)
+ Y("Object_A") < Y_Zone_Center + (Zone_Height / 2)
-> Set In_Zone("Object_A") to 1


To count the number of objects whose value is X (or in this case, whose "In_Zone" = 1), there are two alternatives.
1.) The hard way, which is to fastloop through each instance of the object (by comparing a spread alterable value to the loop index), and individually check their alterable values.
2.) The super easy way, which is to simply use the "Select Object" extension

Edited by Sketchy

 
n/a

superpower



Registered
  07/06/2010
Points
  27
15th June, 2010 at 14:20:33 -

I'm having HUGE trouble with something that is essential in my upcoming game. I need enemies to move over if they're overlapping another enemy so that you can't kill them both with one punch. Everything I've tried has resulted in a complete failure. It doesn't matter what kind of movement engines and stuff you use. What fails for me is that if I do something like checking the position relative to another instance of the same enemy, it instead of using another instance as a comparison uses itself as the comparison. Bottom line: how would you do it!? I wan't to hear every suggestion from hitboxes to spread values (altough I've heard spread values are trouble when exporting to flash).

- Thanks TDC

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
15th June, 2010 at 15:22:24 -

It's a lot easier if you prevent the enemies from ever overlapping in the first place, rather than trying to separate them after. As part of their movement system, you should check that there isn't another object already in their path.

When you want to compare values from two instances of the same object, you usually need to store a value in an intermediate (eg. a counter).

eg. If you wanted to check if any two instances of "Object" are within 100 pixels of one another...

+ Always
-> Spread value 0 in ID("Object")

+ Always
-> Start Fastloop "Check1", NObjects("Object")

+ On Loop "Check1"
-> Start Fastloop "Check2", NObjects("Object")

+ On Loop "Check2"
+ ID("Object") = LoopIndex("Check1")
-> Set XCounter to X("Object")
-> Set YCounter to Y("Object")

+ On Loop "Check2"
+ ID("Object") = LoopIndex("Check2")
-> Set Distance("Object") to Sqr(((XCounter - X("Object")) pow 2) + ((YCounter - Y("Object")) pow 2))

+ On Loop "Check2"
+ ID("Object") = LoopIndex("Check2")
+ Distance("Object") < 100
-> the object whose ID = LoopIndex("Check1") is within 100 pixels of the one whose ID = LoopIndex("Check2")


Again though, it's very rare that you actually need to do any of this - there's usually a better way to achieve the same overall effect.

 
n/a

superpower



Registered
  07/06/2010
Points
  27
17th June, 2010 at 07:25:01 -


Originally Posted by Sketchy

+ On Loop "Check2"
+ ID("Object") = LoopIndex("Check2")
+ Distance("Object") < 100
-> the object whose ID = LoopIndex("Check1") is within 100 pixels of the one whose ID = LoopIndex("Check2")




Isn't "the object whose ID = LoopIndex("Check1") is within 100 pixels of the one whose ID = LoopIndex("Check2")" supposed to be a condition and not an event!?
And if not, could you explain what is going on?

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1971

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
17th June, 2010 at 11:24:58 -

No, I just meant that if the other three conditions are true, then you know which two objects are within 100 pixels of each other - you'd insert you own action depending on what you wanted to happen.

 
n/a

superpower



Registered
  07/06/2010
Points
  27
18th June, 2010 at 12:11:12 -


Originally Posted by Sketchy
No, I just meant that if the other three conditions are true, then you know which two objects are within 100 pixels of each other - you'd insert you own action depending on what you wanted to happen.



I still can't get it to work, darn it! "Distance" is an alterable value right? Do I need multiple counters!?
The distance formula I used looks like this:
Sqr(((value( "XCounter" )-X( "Enemy Test" )) pow 2)+((value( "YCounter" )-Y( "Enemy Test" )) pow 2))

For some reason it runs the action (where the enemy is supposed to move over) all the time even though his value is more than 100.
I did the last conditions you mentioned exactly the way it's supposed to be.

Hmmm... Seems like one guys "distance" is always set to 0 for some reason. I think that with this set up the other enemies are comparing they're distance to the enemy who's distance is 0.



The comment overhead is obsolete (I'll leave it there just for laughs though) since:
Duhhh. I just realized that you didn't mean "counter" by "counter". Uhhh... I've probably suffered a serious burnout or something

Man.... What an EPIC fail!

I must say though. The effect of my frankly "best laugh ever"-fail was interesting to say the least

Edited by superpower

 
n/a

superpower



Registered
  07/06/2010
Points
  27
18th June, 2010 at 14:31:08 -

If I remove the "Set XCounter to X position"-event the distance becomes the objects x position in the frame. However, if I use the event the distance is always set to 0. Any ideas?

 
n/a

superpower



Registered
  07/06/2010
Points
  27
18th June, 2010 at 14:43:18 -

I'm so close to giving up on this game and the entire program. How hard can it be to make it so that two bad guys won't overlap each other and still follow the player around?
My game works like this.
When a hitbox hits the enemy, he starts chasing the player.
Depending on which side of the player he is, his moving value will change to either positive or negative.
When his moving value is -1 he will move left from his own position 5px every 0,03 seconds and vice versa.

How would you make it so that the enemy can't overlap another instance of itself?

Stuff like this doesn't work:
When enemy is overlapping enemy change moving to 0.
Since the enemies will then get trapped in an eternal "overlapping" cycle.

Any ideas will be appreciated...

Edited by superpower

 
n/a
   

Post Reply



 



Advertisement

Worth A Click