Few questions.

For questions about using Classic.

Post » Tue Jul 13, 2010 12:41 pm

during development i ran into some problems that arent totally covered in wiki or tutorials. so I am asking you now :D.

1. I want to make semi-procedural destruction for props. Now i think that my sprite (small cube) should spawn at death four copies of itself scaled down by half. I need to know how to spawn objects in specific position and dimensions.
2. How to compare speed of simulated sprite on the collision event?
B
5
S
1
G
2
Posts: 70
Reputation: 1,140

Post » Tue Jul 13, 2010 2:14 pm

to spawn sprites in specific locations with specific dimensions

System : Create Object (let's you specify the location)
Sprite.SetWidth
Sprite.SetHeight

actions after an object is created, and in the same event will apply to the object that was just created


if you're using behaviors to move your sprites, most behaviors have an expression for speed,
for instance, Set private variable MyCollisionSpeed to
and then double click on the sprite, and click on the behaviors tab to find the expression for speed

if you're using your own movement method, and no behavior, the way to determine speed is to set up two private variables, previousx, and previousy
if you need absolute speed, or the specific x and y speed
always
set absspeed to distance(previousx,previousy,sprite.x,sprite.y)
set xspeed to(sprite.x-previousx)
set yspeed to (sprite.y-previousy)
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue Jul 13, 2010 2:51 pm

Thanks lucid for fast answear! That knowlege should be in wiki anyway :D. (if it is - im dumb).

Edit: Another problem, oddly physics behaviour doesn't have expression for speed, guess i had to do that the other way.

and the "distance" doesent work for me. simply theres no command like this.
and how to setup those previuosx/y variables? just make them or insert some code ?
B
5
S
1
G
2
Posts: 70
Reputation: 1,140

Post » Wed Jul 14, 2010 3:12 am

there is a command
just type distance(somethingx,somethingy,somethingelsex,somethingelsey)
and sorry
at the end of that example I gave you
previousx = sprite.x
previousy=sprite.y

previousx and previousy being private variables you made

also,physics does have an expression for speed
this won't do anything, but just to help you find the expressions, do something like
sprite - set angle
instead of typing in a new angle, double click a sprite with physics behavior, when it brings up the list of expressions, click on the physics tab, that's the list of physics expressions

velocity x component and y component
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Wed Jul 14, 2010 9:07 pm

Thanks alot! Now it's working .
B
5
S
1
G
2
Posts: 70
Reputation: 1,140


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests