トピック
Clayton DarkClay88

Duplicate Sprites

Is there any way you can duplicate one sprite with different attributes without making a bunch of SPSETS?
6そうだね
プレイ済み
返信[1]
親投稿
Jacob Sonicfan08
You would probably have to create a new space, since adding an attribute in the same space would give everyone of that enemy the attributes. So, yea. You're gonna create more space.
0そうだね
未プレイ
返信[2]
親投稿
raimondz raimondxz
There isn't one. However you can make a function to do that with DEF. Here is an example: 1|DEF clone(I) 2| VAR DN=SPCHR(I) 3| VAR X,Y,W,H 4| VAR SP 5| SPOFS I OUT X,Y 6| SPSCALE I OUT W,H 7| 8| SP=SPSET(DN) 9| SPOFS SP,X,Y 10| SPSCALE SP,W,H 11| RETURN SP 12|END
1そうだね
プレイ済み
返信[3]
親投稿
raimondz raimondxz
Here is an example to use that: VAR SP1,SP2,SP3 SP1=SPSET(6) SPSCALE SP1,4,4 SP2=clone(SP1) SPOFS SP2 100,100 SP3=clone(SP1) SPOFS SP3 200,100
1そうだね
プレイ済み
返信[4]
親投稿
Clayton DarkClay88
Ooooh okay, I gotcha.
0そうだね
プレイ済み
返信[5]
親投稿
Clayton DarkClay88
raimondz, I need your assistance again. xP I'm having trouble with collision in one of my newer games. I was wondering if you could help me out with it? x)
0そうだね
プレイ済み
返信[6]
親投稿
raimondz raimondxz
I suppose the problem is the collision with walls. I can't explain you right now how it works but I posted a code to handle that case on smilebasicsource. On the search bar type "wall collision" and click on the first result.
0そうだね
プレイ済み
返信[7]
親投稿
Clayton DarkClay88
Actually it's sprite collision. SPHITSP to be exact. I have this invisible sprite box that pops out when you press B (but for some reason, if you press any button it will pop out). The box is suppose to hit other sprites but it is not working. I did SPCOL and everything.
0そうだね
プレイ済み
返信[8]
親投稿
raimondz raimondxz
You must call spcol on every sprite that can collide. SPCOL sprite,[Scale adjustment],[MASK] Sprite is the number associated with your sprite. Scale adjustment should be set as true. Mask is a binary variable that let you put category for collision.
0そうだね
プレイ済み
返信[9]
親投稿
raimondz raimondxz
For example, you could have bullets that will collide with the player but not with the enemy, and viceversa. So you can use 2 categories: 1(&B01) = Player bullet var PLAYER_BULLET=&B01 2(&B10) = Enemy bullet. var ENEMY_BULLET=&B10 SPCOL SPEBullet,1,ENEMY_BULLET If you want a bullet that collide with both the player and the enemy, then: SPCOL SPEBullet,1,ENEMY_BULLET OR PLAYER_BULLET
0そうだね
プレイ済み
返信[10]
親投稿
raimondz raimondxz
If you don't put value in mask, then the sprite could collide with everything. ========================== Now SPHITSP let you find the first sprite that is overlapping the one in the argument. This mean if two sprites overlap one in a frame, then the function will return the one with the lowest managment number.
0そうだね
プレイ済み
返信[11]
親投稿
raimondz raimondxz
Almost forgot something about SPCOL: the collider will be a rectangle of the same size as the original sprite. However, you can define a bigger hitbox with SPCOL(See page 3 on the help screen of SPCOL)
0そうだね
プレイ済み
返信[12]
親投稿
Clayton DarkClay88
I'm hitting the hitbox sprite with the tree sprite(s) but it's not doing what they computer is telling it to do. :0
0そうだね
プレイ済み
返信[13]
親投稿
Clayton DarkClay88
Its really odd.
0そうだね
プレイ済み
返信[14]
親投稿
raimondz raimondxz
That's strange. Can you post a key of your program? maybe I can do something.
0そうだね
プレイ済み
返信[15]
親投稿
Clayton DarkClay88
Ok! I will tonight.
0そうだね
プレイ済み
返信[16]
親投稿
Clayton DarkClay88
Key: LSDQE3A4
0そうだね
プレイ済み
返信[17]
親投稿
raimondz raimondzz
Well, I found a lot of issues: -From here, if you're creating the same kind of entity(Tree in this case), then use an array to store them and their properties. -You don't need to do SPOFS in the loop if the tree aren't moving. Remember that the camera do that stuff for you. -SPHIT only work if the Sprite is visible. When you're using SPHITSP, the hitbox is already hidden.
0そうだね
プレイ済み
返信[18]
親投稿
raimondz raimondzz
-If you have plans to add enemies or active entities in the future, then you shouldn't use WAIT to handle the punch. That will pause the entire game. I will upload the code later.
0そうだね
プレイ済み
返信[19]
親投稿
raimondz raimondzz
KEY: XRE3C2QV V1.0 and V1.0B are almost the same code. However V1.0B use wait to handle the hitbox but the other use a timer instead.
0そうだね
プレイ済み
返信[20]
親投稿
Clayton DarkClay88
Oh wow. I'm dumb. Should've known using wait paused the whole thing. :P
0そうだね
プレイ済み