R0J0hound's Recent Forum Activity

  • All the controls objects position themselves in relation to the window, not the layout. Also they are unaffected by zooming or scrolling. This is because they are drawn by the Windows GUI not by DirectX. A solution for your problem would be to calculate the window position of the sprite:

    -> ListBox: Set position to (Sprite.X-ScrollXLeft)*ZoomX/100, (Sprite.Y-ScrollYTop)*ZoomY/100[/code:y08gwiz9]
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here's a fixed cap:

    http://dl.dropbox.com/u/5426011/fixed/fovfixed.cap

    Only one block was showing because the player had the solid attribute so any other block could not be seen through the player. The block was off center because the mask size was incorrect.

    The mask size should be this:

    Width: 1024/32 = 32

    Height: 768/32 = 24

    With the different size i also adjusted the numbers in the events.

    I removed the colmap sprite as it was not needed the existing TiledBackground2 object did fine.

    -cheers

  • Here's an example FOV engine with walls that bock vision. Also it uses the imagemanipulator object so less resources are used than using the canvas object.

    http://www.scirra.com/forum/viewtopic.php?f=16&t=6679&start=0

  • Here is an example of a field of view engine using the image manipulator. I just used over sized pixels for the example but it is easy enough to use sprites instead. The advantage of using the image manipulator as opposed to a canvas is a very small amount of memory is used (a 20x30 pixel image for a 640x960 pixel layout with 32 pixel tiles).

    Enjoy

  • Here is a python script for ease in and out camera motion.

    class myscroll:
    	def __init__(self):
    		self.acceleration=100;		
    		self._ax=0;	self._ay=0
    		self._vx=0;	self._vy=0
    
    	def __call__(self, obj):
    		myscrollx=(System.ScrollXLeft+System.ScrollXRight)/2
    		myscrolly=(System.ScrollYTop+System.ScrollYBottom)/2
    
    		# x motion
    		diff=obj.X-myscrollx
    		if abs(diff)<1:
    			self._ax=0;  self._vx=0
    		else:
    			if self._vx**2/(2*self.acceleration) >= abs(diff):
    				self._ax=-1*cmp(self._vx,0)*self.acceleration
    			else:
    				self._ax=cmp(diff,0)*self.acceleration
    
    		# y motion
    		diff=obj.Y-myscrolly
    		if abs(diff)<1:
    			self._ay=0;  self._vy=0
    		else:
    			if self._vy**2/(2*self.acceleration) >= abs(diff):
    				self._ay=-1*cmp(self._vy,0)*self.acceleration
    			else:
    				self._ay=cmp(diff,0)*self.acceleration
    
    		self._vx+=self._ax*System.TimeDelta
    		self._vy+=self._ay*System.TimeDelta
    		System.ScrollX(myscrollx+self._vx*System.TimeDelta)
    		System.ScrollY(myscrolly+self._vy*System.TimeDelta)
    myscroll=myscroll()[/code:2fwplqvv]
    No need to understand how it works, just have that script run at the "start of layout" and call "myscroll(Sprite)" every tick.  The only setting is acceleration, which can be changed at any time with the script "myscroll.acceleration=400".
    
    Basically what it does is accelerate the camera to the object and then decelerate so that when the screen arrives at the object the camera speed will be zero.
    
    Example of use: [url]http://dl.dropbox.com/u/5426011/examples/camera%20easeinandout.cap[/url]
    req at least 0.99.84
    
    Feel free to use or enhance.
  • A solution for the jitter would be to stop the motion and point to the target when the angle difference and angular velocity are lower than some thresholds.

    Add this event to the "targeting" group:

    + System: AngleDiff(turret.Angle, turret ('target')) Lower than 0.5
    + System: abs(turret[Physics].AngularVelocity) Lower than 0.2
    -> turret: Set torque 0
    -> turret: Set angular velocity to 0
    -> turret: Set angle to 'target'[/code:1pqycuqz]
  • Finally got an example for a physics turret working:

    http://dl.dropbox.com/u/5426011/examples/PhysicsTurret.cap

    and tweaked so it works with multiple turrets:

    http://dl.dropbox.com/u/5426011/examples/multiPhysicsTurret.cap

    The only drawback is the turret's inertia needs to be calculated (which I do in the first second). Also the calculated inertia is not 100% accurate so the turrets jitter a bit when pointing at the target.

    -enjoy

  • Here's an example made by Rich :

    http://www.scirra.com/forum/viewtopic.php?f=16&t=2210

  • Here's another way to do it:

    Initially give "Sprite" the attribute solid. Sprite only needs 1 private variable 'time'.

    EDIT:

    Also add a box object and add it to a container with sprite. The box objects will serve as the collision detection for sprite because when sprite is set to no collision an overlapping condition can never be true.

    Here's what I came up with:

    http://dl.dropbox.com/u/5426011/examples/hideplatform.cap

  • Constant 8 fps

    Pentium 3 866 Mhz

    512 Mb Ram

    Nvidia GeForce FX 5200 (128 Mb)

  • The nice thing about using behaviors is you don't need to worry about TimeDelta, because it's handled within the behavior.

    You can simplify your events and it will behave exactly the same and be more readable:

    + MouseKeyboard: Key Up arrow is down
    -> Sprite: Set force Sprite.value('Thrust') towards (Sprite.X + cos(Sprite.Angle), Sprite.Y + sin(Sprite.Angle))
    + MouseKeyboard: Key Left arrow is down
    -> Sprite: Set torque 0-Sprite.value('Rotation')
    + MouseKeyboard: Key Right arrow is down
    -> Sprite: Set torque Sprite.value('Rotation')[/code:1fvwdf3w]
  • Sagal's right, just use the "every" condition, much simpler. I compared the two methods and found that they behaved pretty much the same. I'm continuously impressed on how so many tasks are very simple to do in construct.

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 155 followers

Connect with R0J0hound