Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411283 Posts in 69325 Topics- by 58380 Members - Latest Member: bob1029

March 29, 2024, 03:56:51 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityTownhallForum IssuesArchived subforums (read only)Tutorialsstress with multiples of the same objects... bleh!
Pages: [1]
Print
Author Topic: stress with multiples of the same objects... bleh!  (Read 1345 times)
Conker534
Guest
« on: December 08, 2013, 12:13:36 AM »

There are two main objects in this prototype

obj_fighter and obj_buffer

obj_fighter asks for 3 buffs with variable needbuff=0,1,2
obj_buffer has a variable power, which levels up as it becomes stronger

because i have multiple of these objects, i cant just make like
obj_fighter.power+=obj_buffer.power because all of them would be buffed, when i only want them to effect each other in pairs.

How would I make obj_fighter check for the nearest obj_buffer and then do the following

obj_buffer.ppower+=ppower
nearest obj_buffer.xp+=1

obj_fighter.stepevent
Code:
if place_meeting(x,y,obj_buffer) and needbuff=2{

ppower+=instance_nearest(obj_buffer.ppower)


with instance_nearest(x,y,obj_buffer){
if energy<=energymax and energy>0{timer+=1}
if timer>=10{energy-=1 xp+=1 timer=0}
}
}
« Last Edit: December 08, 2013, 01:08:54 AM by Michael Pettinato » Logged
noumenus
Level 2
**


tired


View Profile
« Reply #1 on: December 09, 2013, 03:02:29 PM »

Place all of the buffers id into a list, go through the list to see which one in the list is nearest, use the ds_list_find_value to get the id of the nearest instance of buffer
Logged

Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic