The Daily Click ::. Forums ::. Klik Coding Help ::. Lifting Only One Object
 

Post Reply  Post Oekaki 
 

Posted By Message

LilSpriteX



Registered
  08/05/2003
Points
  28
29th May, 2006 at 03:24:42 -

I have coded my characters to life an item when I hit the up arrow and when they are overlapping said item. The problem is how to code it so that the character will only pick up one item instead of two or more if he/she is overlapping more than one. I've tried picking the object at random, but that only has sporadic success. Is there a way to make my character only pick up only one object every time?

 
n/a

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
29th May, 2006 at 07:40:20 -

I think the pick one object at random should work, just make sure you have that condition after the overlapping one. Eg.
Player is overlapping box
+ Pick a box at random

Not:
Pick a box at random
+Player is overlapping box

 
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

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
29th May, 2006 at 14:53:51 -

Or maybe you could spread a value through the boxes and pick the one with the lowest value somehow.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
29th May, 2006 at 15:44:55 -

That's probably overkill.

 
n/a

AndyUK

Mascot Maniac

Registered
  01/08/2002
Points
  14586

Game of the Week WinnerSecond GOTW AwardHas Donated, Thank You!VIP Member
29th May, 2006 at 16:32:23 -

you could 'pick one at random' and drop it if more than one is lifted.
Although this will make them still be picked up, they will drop all the other items until one is left.

I didn't have this problem ever in any of my games.

 
.

Hernan



Registered
  04/03/2003
Points
  707

VIP Member
29th May, 2006 at 18:37:50 -

Like Assault Andy says, but with "only one action when event loops"
eg:

Player is overlapping box
+ Pick a box at random
+ Up arrow is pressed
+ Only one action when event loops

Without the "only one action when event loops" it'll still 'pick up' all objects. At least, in my case it always does.

 
This space is for rent

Werbad



Registered
  18/09/2002
Points
  235
29th May, 2006 at 19:17:03 -

It's not supposed to pick all objects in that case unless you use Repeat While Pressing Up...

Player is overlapping box
+ Pick a box at random
+ Up arrow is pressed

This worked just fine when i tried it...
There could be a problem somewhere else in the code...

 
n/a

LilSpriteX



Registered
  08/05/2003
Points
  28
30th May, 2006 at 02:30:56 -

I found the problem. I was using qualifiers instead of individual objects. I had no idea that would affect anything. With qualifiers, the pick at random wouldn't work, and the "up arrow is pressed" wouldn't work unless it was at the top of the conditions. Is there a way to make this work with qualifiers, or will I need a seperate event for keys, a seperate event for boxes, for bombs, etc.?

Thanks a lot for all your help.

Image Edited by the Author.

 
n/a

Radix

hot for teacher

Registered
  01/10/2003
Points
  3139

Has Donated, Thank You!VIP MemberGOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!
30th May, 2006 at 03:55:22 -

It should work with qualifiers. They can be a bitch sometimes but this sort of thing is usually okay. The order of your conditions is always very important.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click