Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 12, 2016 9:30:19 GMT -5
If you want a static jump and to ignore the j.2 and j.3 variables, then set your conditions to move require that the jump buttons are 0
|
|
|
Post by Sg on Jun 12, 2016 13:20:27 GMT -5
edit post:
just use the movesprite function without propsprite and it's good
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 14, 2016 8:50:46 GMT -5
You can also use shiftsprite which moves the Sprite relative to its location, so that way if you are using a lot of spriteposx and spriteposy commands, shiftsprite might yield you more optimal results. Glad you resolved the issue
|
|
|
Post by Sg on Jun 20, 2016 18:35:01 GMT -5
i use this thread for posting some questions question too How duplicate the same sprite 10 times in different coordinate positions at the same time ? A sprite can be only in 1 given place at a time, so there's 3 options for you: 1. Create 10 total sprites and place them where you need them to be 2. Use flickering 3. If they're just static sprites (ie, will never move), you can draw them on a background plane and use collision detection to interact with them for the response 3, if i have 10 same sprites on the background and i want detection collision with the player sprite and if i use b is a building for example px = spriteposx(d) py = spriteposy(d) mx = spriteposx(b) my = spriteposy(b) mx = spriteposx(b2) my = spriteposy(b2) mx = spriteposx(b3) my = spriteposy(b3) mx = spriteposx(b4) my = spriteposy(b4) mx = spriteposx(b5) my = spriteposy(b5) ... mx = spriteposx(b10) my = spriteposy(b10) if px = mx and py+2 = my then detection only the b10 sprite is detected have you a fast thing to do that (bettet than create the routine for each sprite) ?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 20, 2016 18:38:54 GMT -5
It will only detect the last one because you're only checking the last values set for mx and my
|
|
|
Post by Sg on Jun 20, 2016 18:54:03 GMT -5
How to check all the values ?
px = spriteposx(d) py = spriteposy(d) mx = spriteposx(b) my = spriteposy(b) mx1 = spriteposx(b2) my1 = spriteposy(b2) mx2 = spriteposx(b3) my2 = spriteposy(b3) mx3 = spriteposx(b4) my3 = spriteposy(b4) mx4 = spriteposx(b5) my4 = spriteposy(b5) ... mx9 = spriteposx(b10) my9 = spriteposy(b10)
if px = mx = mx1= mx2 = mx3 ... and py+2 = my= my1= my2 = my3 ... then detection ?
or if px = mx; mx1;mx2 ;mx3 ... and py+2 = my; my1; my2 ;my3 ... then detection ?
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 20, 2016 19:39:36 GMT -5
mx = spriteposx(b) my = spriteposy(b) if px = mx and py+2 = my then detection mx = spriteposx(b5) my = spriteposy(b5) if px = mx and py+2 = my then detection
and so on...
|
|
|
Post by Sg on Jun 21, 2016 8:42:45 GMT -5
This what i did but with my code (and with more ten sprites , is too long : special detection with change sprite and scrolling) so i need a routine which detect all sprite in one
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 21, 2016 11:47:28 GMT -5
You'll need to write a routine to do that Every project will have different requirements, so I could write something for you that may not work.
|
|
|
Post by Sg on Jun 21, 2016 12:20:02 GMT -5
hi elusive
Does it exist a particular writing to code this?
px = spriteposx(d) py = spriteposy(d) mx = spriteposx(b);spriteposx(b2);spriteposx(b3);spriteposx(b...) my = spriteposy(b);spriteposy(b2);spriteposy(b3);spriteposy(b...)
(to detect all)
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 21, 2016 13:04:49 GMT -5
There's a lot of ways to detect collision. Search the threads here as I believe moon and Titan had posted examples at one point. Each program is different, so you'll have to devise your own methods.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 21, 2016 14:17:41 GMT -5
The generic soft collision example code seems to be this:
declare function softcol(x1 as integer, y1 as integer, x2 as integer, y2 as integer, x3 as integer, y3 as integer, x4 as integer, y4 as integer) as integer if x1 > x4 then return 0 if x2 < x3 then return 0 if y1 > y4 then return 0 if y2 < y3 then return 0 return 1 end function
There may be some semi hidden/obscure BEX command to check for *any* collision with *any* sprite but I think Devster said it was somehow awkward.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 21, 2016 14:26:43 GMT -5
Yes, the collision bit (not BEX specific, it's part of the m68k), but it doesn't tell you which object collided, only that 2 non transparent pixels overlapped, meaning for more than 1 object, it's pretty useless.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 23, 2016 22:35:08 GMT -5
My strategy is to check for collisions only a certain fraction of frames. Since soft collisions can get expensive this lessens their impact on performance.
I could also see a strategy where one would wait for that magic bit to be triggered and then do all of your soft collision checking.
Does anyone remember the name of the BEX command to do that any/all collision checking? If not, how would we access this magic bit?
UPDATE: Found what little documentation I could. it was in a file called othercmd.txt. Dunno where it came from or if it's even a working command in this version of BEX.
UPDATE II: Found an example of usage called collision_detection.bex
a=addsprite(1,1) b=addsprite(1,1) propsprite a,1,1 propsprite b,2,2 movesprite a,256,256 c=263 while 1 movesprite b,256,c ' sleep 1 c=c-1 d=collision(128,135) locate 0,0 print d wend
|
|
|
Post by nathan999 on Jun 24, 2016 8:22:43 GMT -5
Yes, the collision bit (not BEX specific, it's part of the m68k), but it doesn't tell you which object collided, only that 2 non transparent pixels overlapped, meaning for more than 1 object, it's pretty useless. Not quite. In fact, it's very useless. It's a hardware assisted tool to have pixel-perfect collision. You check for collisions "in software" using box intersection, for example. If you detect that two objects' boxes are colliding, you then check the hardware flag. If the hardware flag is clear, no collision should be registered. If it is set, the two objects are colliding.
|
|