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.
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
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)
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.
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.
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.
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
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.
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)
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.
-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.